about summary refs log tree commit diff
path: root/pkgs/applications/science/robotics/mujoco/mujoco-system-deps-dont-fetch.patch
blob: 15373eb0b60fa2eb620b6b79d82e61969e1d9c6e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 285250b..32d03e3 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -92,7 +92,7 @@ add_subdirectory(src/render)
 add_subdirectory(src/thread)
 add_subdirectory(src/ui)
 
-target_compile_definitions(mujoco PRIVATE _GNU_SOURCE CCD_STATIC_DEFINE MUJOCO_DLL_EXPORTS -DMC_IMPLEM_ENABLE)
+target_compile_definitions(mujoco PRIVATE _GNU_SOURCE MUJOCO_DLL_EXPORTS -DMC_IMPLEM_ENABLE)
 if(MUJOCO_ENABLE_AVX_INTRINSICS)
   target_compile_definitions(mujoco PUBLIC mjUSEPLATFORMSIMD)
 endif()
@@ -117,7 +117,7 @@ target_link_libraries(
           lodepng
           qhullstatic_r
           tinyobjloader
-          tinyxml2
+          tinyxml2::tinyxml2
 )
 
 set_target_properties(
diff --git a/cmake/MujocoDependencies.cmake b/cmake/MujocoDependencies.cmake
index 4e3e2c8..f6143d9 100644
--- a/cmake/MujocoDependencies.cmake
+++ b/cmake/MujocoDependencies.cmake
@@ -90,153 +90,203 @@ set(BUILD_SHARED_LIBS
     CACHE INTERNAL "Build SHARED libraries"
 )
 
+
 if(NOT TARGET lodepng)
-  FetchContent_Declare(
+  fetchcontent_declare(
     lodepng
-    GIT_REPOSITORY https://github.com/lvandeve/lodepng.git
-    GIT_TAG ${MUJOCO_DEP_VERSION_lodepng}
   )
+endif()
+
+if(NOT TARGET lodepng)
+  if(NOT MUJOCO_USE_SYSTEM_lodepng)
+    fetchcontent_declare(
+      lodepng
+      GIT_REPOSITORY https://github.com/lvandeve/lodepng.git
+      GIT_TAG ${MUJOCO_DEP_VERSION_lodepng}
+    )
 
-  FetchContent_GetProperties(lodepng)
-  if(NOT lodepng_POPULATED)
-    FetchContent_Populate(lodepng)
-    # This is not a CMake project.
-    set(LODEPNG_SRCS ${lodepng_SOURCE_DIR}/lodepng.cpp)
-    set(LODEPNG_HEADERS ${lodepng_SOURCE_DIR}/lodepng.h)
-    add_library(lodepng STATIC ${LODEPNG_HEADERS} ${LODEPNG_SRCS})
-    target_compile_options(lodepng PRIVATE ${MUJOCO_MACOS_COMPILE_OPTIONS})
-    target_link_options(lodepng PRIVATE ${MUJOCO_MACOS_LINK_OPTIONS})
-    target_include_directories(lodepng PUBLIC ${lodepng_SOURCE_DIR})
+    fetchcontent_getproperties(lodepng)
+    if(NOT lodepng_POPULATED)
+      fetchcontent_populate(lodepng)
+      # This is not a CMake project.
+      set(LODEPNG_SRCS ${lodepng_SOURCE_DIR}/lodepng.cpp)
+      set(LODEPNG_HEADERS ${lodepng_SOURCE_DIR}/lodepng.h)
+      add_library(lodepng STATIC ${LODEPNG_HEADERS} ${LODEPNG_SRCS})
+      target_compile_options(lodepng PRIVATE ${MUJOCO_MACOS_COMPILE_OPTIONS})
+      target_link_options(lodepng PRIVATE ${MUJOCO_MACOS_LINK_OPTIONS})
+      target_include_directories(lodepng PUBLIC ${lodepng_SOURCE_DIR})
+    endif()
+  else()
+    find_package(lodepng REQUIRED)
   endif()
 endif()
 
 if(NOT TARGET marchingcubecpp)
-  FetchContent_Declare(
+  fetchcontent_declare(
     marchingcubecpp
-    GIT_REPOSITORY https://github.com/aparis69/MarchingCubeCpp.git
-    GIT_TAG ${MUJOCO_DEP_VERSION_MarchingCubeCpp}
   )
 
-  FetchContent_GetProperties(marchingcubecpp)
+  fetchcontent_getproperties(marchingcubecpp)
   if(NOT marchingcubecpp_POPULATED)
-    FetchContent_Populate(marchingcubecpp)
+    fetchcontent_populate(marchingcubecpp)
     include_directories(${marchingcubecpp_SOURCE_DIR})
   endif()
 endif()
 
+option(MUJOCO_USE_SYSTEM_qhull "Use installed qhull version." OFF)
+mark_as_advanced(MUJOCO_USE_SYSTEM_qhull)
+
 set(QHULL_ENABLE_TESTING OFF)
 
 findorfetch(
   USE_SYSTEM_PACKAGE
-  OFF
+  ${MUJOCO_USE_SYSTEM_qhull}
   PACKAGE_NAME
-  qhull
+  Qhull
   LIBRARY_NAME
   qhull
-  GIT_REPO
-  https://github.com/qhull/qhull.git
-  GIT_TAG
-  ${MUJOCO_DEP_VERSION_qhull}
   TARGETS
   qhull
   EXCLUDE_FROM_ALL
 )
-# MuJoCo includes a file from libqhull_r which is not exported by the qhull include directories.
-# Add it to the target.
-target_include_directories(
-  qhullstatic_r INTERFACE $<BUILD_INTERFACE:${qhull_SOURCE_DIR}/src/libqhull_r>
-)
-target_compile_options(qhullstatic_r PRIVATE ${MUJOCO_MACOS_COMPILE_OPTIONS})
-target_link_options(qhullstatic_r PRIVATE ${MUJOCO_MACOS_LINK_OPTIONS})
+
+if(NOT MUJOCO_USE_SYSTEM_qhull)
+  # MuJoCo includes a file from libqhull_r which is not exported by the qhull include directories.
+  # Add it to the target.
+  target_include_directories(
+    qhullstatic_r INTERFACE $<BUILD_INTERFACE:${qhull_SOURCE_DIR}/src/libqhull_r>
+  )
+  target_compile_options(qhullstatic_r PRIVATE ${MUJOCO_MACOS_COMPILE_OPTIONS})
+  target_link_options(qhullstatic_r PRIVATE ${MUJOCO_MACOS_LINK_OPTIONS})
+else()
+  if(NOT TARGET qhullstatic_r)
+    add_library(qhullstatic_r INTERFACE)
+    set_target_properties(qhullstatic_r PROPERTIES INTERFACE_LINK_LIBRARIES Qhull::qhull_r)
+
+    # Workaround as headers are installed in <prefix>/include/libqhull_r/something.h
+    # but mujoco include them as #include <something.h>
+    get_property(qhull_include_dirs TARGET Qhull::qhull_r PROPERTY INTERFACE_INCLUDE_DIRECTORIES)
+    foreach(qhull_include_dir IN LISTS qhull_include_dirs)
+      target_include_directories(qhullstatic_r INTERFACE ${qhull_include_dirs}/libqhull_r)
+    endforeach()
+    target_include_directories(qhullstatic_r INTERFACE )
+  endif()
+endif()
+
+option(MUJOCO_USE_SYSTEM_tinyxml2 "Use installed tinyxml2 version." OFF)
+mark_as_advanced(MUJOCO_USE_SYSTEM_tinyxml2)
 
 set(tinyxml2_BUILD_TESTING OFF)
 findorfetch(
   USE_SYSTEM_PACKAGE
-  OFF
+  ${MUJOCO_USE_SYSTEM_tinyxml2}
   PACKAGE_NAME
   tinyxml2
   LIBRARY_NAME
   tinyxml2
-  GIT_REPO
-  https://github.com/leethomason/tinyxml2.git
-  GIT_TAG
-  ${MUJOCO_DEP_VERSION_tinyxml2}
   TARGETS
-  tinyxml2
+  tinyxml2::tinyxml2
   EXCLUDE_FROM_ALL
 )
-target_compile_options(tinyxml2 PRIVATE ${MUJOCO_MACOS_COMPILE_OPTIONS})
-target_link_options(tinyxml2 PRIVATE ${MUJOCO_MACOS_LINK_OPTIONS})
+
+if(NOT MUJOCO_USE_SYSTEM_tinyxml2)
+  target_compile_options(tinyxml2 PRIVATE ${MUJOCO_MACOS_COMPILE_OPTIONS})
+  target_link_options(tinyxml2 PRIVATE ${MUJOCO_MACOS_LINK_OPTIONS})
+endif()
+
+option(MUJOCO_USE_SYSTEM_tinyobjloader "Use installed tinyobjloader version." OFF)
+mark_as_advanced(MUJOCO_USE_SYSTEM_tinyobjloader)
 
 findorfetch(
   USE_SYSTEM_PACKAGE
-  OFF
+  ${MUJOCO_USE_SYSTEM_tinyobjloader}
   PACKAGE_NAME
   tinyobjloader
   LIBRARY_NAME
   tinyobjloader
-  GIT_REPO
-  https://github.com/tinyobjloader/tinyobjloader.git
-  GIT_TAG
-  ${MUJOCO_DEP_VERSION_tinyobjloader}
   TARGETS
   tinyobjloader
   EXCLUDE_FROM_ALL
 )
 
+if(MUJOCO_USE_SYSTEM_tinyobjloader)
+  # As of tinyobjloader v2.0.0rc10, the tinyobjloader target is named tinyobjloader in the build,
+  # but tinyobjloader::tinyobjloader when it is installed. To deal with this, if tinyobjloader is
+  # found in the system, we create an ALIAS
+  # The following is equivalent to add_library(tinyobjloader ALIAS tinyobjloader::tinyobjloader),
+  # but compatible with CMake 3.16 . Once the minimum CMake is bumped to CMake 3.18, we can use
+  # the simpler version
+  add_library(tinyobjloader INTERFACE IMPORTED)
+  set_target_properties(tinyobjloader PROPERTIES INTERFACE_LINK_LIBRARIES tinyobjloader::tinyobjloader)
+endif()
+
+option(MUJOCO_USE_SYSTEM_sdflib "Use installed sdflib version." OFF)
+mark_as_advanced(MUJOCO_USE_SYSTEM_sdflib)
+
 option(SDFLIB_USE_ASSIMP OFF)
 option(SDFLIB_USE_OPENMP OFF)
 option(SDFLIB_USE_ENOKI OFF)
+
 findorfetch(
   USE_SYSTEM_PACKAGE
-  OFF
+  ${MUJOCO_USE_SYSTEM_sdflib}
   PACKAGE_NAME
-  sdflib
+  SdfLib
   LIBRARY_NAME
   sdflib
-  GIT_REPO
-  https://github.com/UPC-ViRVIG/SdfLib.git
-  GIT_TAG
-  ${MUJOCO_DEP_VERSION_sdflib}
   TARGETS
-  SdfLib
+  SdfLib::SdfLib
   EXCLUDE_FROM_ALL
 )
-target_compile_options(SdfLib PRIVATE ${MUJOCO_MACOS_COMPILE_OPTIONS})
-target_link_options(SdfLib PRIVATE ${MUJOCO_MACOS_LINK_OPTIONS})
+
+if(NOT MUJOCO_USE_SYSTEM_sdflib)
+  target_compile_options(SdfLib PRIVATE ${MUJOCO_MACOS_COMPILE_OPTIONS})
+  target_link_options(SdfLib PRIVATE ${MUJOCO_MACOS_LINK_OPTIONS})
+endif()
+
+option(MUJOCO_USE_SYSTEM_ccd "Use installed ccd version." OFF)
+mark_as_advanced(MUJOCO_USE_SYSTEM_ccd)
 
 set(ENABLE_DOUBLE_PRECISION ON)
 set(CCD_HIDE_ALL_SYMBOLS ON)
 findorfetch(
   USE_SYSTEM_PACKAGE
-  OFF
+  ${MUJOCO_USE_SYSTEM_ccd}
   PACKAGE_NAME
   ccd
   LIBRARY_NAME
   ccd
-  GIT_REPO
-  https://github.com/danfis/libccd.git
-  GIT_TAG
-  ${MUJOCO_DEP_VERSION_ccd}
   TARGETS
   ccd
   EXCLUDE_FROM_ALL
 )
-target_compile_options(ccd PRIVATE ${MUJOCO_MACOS_COMPILE_OPTIONS})
-target_link_options(ccd PRIVATE ${MUJOCO_MACOS_LINK_OPTIONS})
-
-# libCCD has an unconditional `#define _CRT_SECURE_NO_WARNINGS` on Windows.
-# TODO(stunya): Remove this after https://github.com/danfis/libccd/pull/77 is merged.
-if(WIN32)
-  if(MSVC)
-    # C4005 is the MSVC equivalent of -Wmacro-redefined.
-    target_compile_options(ccd PRIVATE /wd4005)
-  else()
-    target_compile_options(ccd PRIVATE -Wno-macro-redefined)
+
+if(NOT MUJOCO_USE_SYSTEM_ccd)
+  target_compile_options(ccd PRIVATE ${MUJOCO_MACOS_COMPILE_OPTIONS})
+  target_link_options(ccd PRIVATE ${MUJOCO_MACOS_LINK_OPTIONS})
+  # This is necessary to ensure that the any library that consumes the ccd
+  # compiled internally by MuJoCo (as static library) has CCD_EXPORT correctly
+  # defined as an empty string. For ccd itself, this is ensured by the variable
+  # CCD_HIDE_ALL_SYMBOLS set to ON before the call to findorfetch
+  # See https://github.com/danfis/libccd/pull/79
+  target_compile_definitions(ccd INTERFACE CCD_STATIC_DEFINE)
+
+  # libCCD has an unconditional `#define _CRT_SECURE_NO_WARNINGS` on Windows.
+  # TODO(stunya): Remove this after https://github.com/danfis/libccd/pull/77 is merged.
+  if(WIN32)
+    if(MSVC)
+      # C4005 is the MSVC equivalent of -Wmacro-redefined.
+      target_compile_options(ccd PRIVATE /wd4005)
+    else()
+      target_compile_options(ccd PRIVATE -Wno-macro-redefined)
+    endif()
   endif()
 endif()
 
 if(MUJOCO_BUILD_TESTS)
+  option(MUJOCO_USE_SYSTEM_abseil "Use installed abseil version." OFF)
+  mark_as_advanced(MUJOCO_USE_SYSTEM_abseil)
+
   set(ABSL_PROPAGATE_CXX_STD ON)
 
   # This specific version of Abseil does not have the following variable. We need to work with BUILD_TESTING
@@ -249,15 +299,11 @@ if(MUJOCO_BUILD_TESTS)
   set(ABSL_BUILD_TESTING OFF)
   findorfetch(
     USE_SYSTEM_PACKAGE
-    OFF
+    ${MUJOCO_USE_SYSTEM_abseil}
     PACKAGE_NAME
     absl
     LIBRARY_NAME
     abseil-cpp
-    GIT_REPO
-    https://github.com/abseil/abseil-cpp.git
-    GIT_TAG
-    ${MUJOCO_DEP_VERSION_abseil}
     TARGETS
     absl::core_headers
     EXCLUDE_FROM_ALL
@@ -268,6 +314,9 @@ if(MUJOCO_BUILD_TESTS)
       CACHE BOOL "Build tests." FORCE
   )
 
+  option(MUJOCO_USE_SYSTEM_gtest "Use installed gtest version." OFF)
+  mark_as_advanced(MUJOCO_USE_SYSTEM_gtest)
+
   # Avoid linking errors on Windows by dynamically linking to the C runtime.
   set(gtest_force_shared_crt
       ON
@@ -276,22 +325,20 @@ if(MUJOCO_BUILD_TESTS)
 
   findorfetch(
     USE_SYSTEM_PACKAGE
-    OFF
+    ${MUJOCO_USE_SYSTEM_gtest}
     PACKAGE_NAME
     GTest
     LIBRARY_NAME
     googletest
-    GIT_REPO
-    https://github.com/google/googletest.git
-    GIT_TAG
-    ${MUJOCO_DEP_VERSION_gtest}
     TARGETS
-    gtest
-    gmock
-    gtest_main
+    GTest::gmock
+    GTest::gtest_main
     EXCLUDE_FROM_ALL
   )
 
+  option(MUJOCO_USE_SYSTEM_benchmark "Use installed benchmark version." OFF)
+  mark_as_advanced(MUJOCO_USE_SYSTEM_benchmark)
+
   set(BENCHMARK_EXTRA_FETCH_ARGS "")
   if(WIN32 AND NOT MSVC)
     set(BENCHMARK_EXTRA_FETCH_ARGS
@@ -310,15 +357,11 @@ if(MUJOCO_BUILD_TESTS)
 
   findorfetch(
     USE_SYSTEM_PACKAGE
-    OFF
+    ${MUJOCO_USE_SYSTEM_benchmark}
     PACKAGE_NAME
     benchmark
     LIBRARY_NAME
     benchmark
-    GIT_REPO
-    https://github.com/google/benchmark.git
-    GIT_TAG
-    ${MUJOCO_DEP_VERSION_benchmark}
     TARGETS
     benchmark::benchmark
     benchmark::benchmark_main
@@ -328,26 +371,42 @@ if(MUJOCO_BUILD_TESTS)
 endif()
 
 if(MUJOCO_TEST_PYTHON_UTIL)
+  option(MUJOCO_USE_SYSTEM_Eigen3 "Use installed Eigen3 version." OFF)
+  mark_as_advanced(MUJOCO_USE_SYSTEM_Eigen3)
+
   add_compile_definitions(EIGEN_MPL2_ONLY)
-  if(NOT TARGET eigen)
-    # Support new IN_LIST if() operator.
-    set(CMAKE_POLICY_DEFAULT_CMP0057 NEW)
+  if(NOT TARGET Eigen3::Eigen)
+    if(NOT MUJOCO_USE_SYSTEM_Eigen3)
+      # Support new IN_LIST if() operator.
+      set(CMAKE_POLICY_DEFAULT_CMP0057 NEW)
+    endif()
 
-    FetchContent_Declare(
+    fetchcontent_declare(
       Eigen3
-      GIT_REPOSITORY https://gitlab.com/libeigen/eigen.git
-      GIT_TAG ${MUJOCO_DEP_VERSION_Eigen3}
     )
 
-    FetchContent_GetProperties(Eigen3)
+    fetchcontent_getproperties(Eigen3)
     if(NOT Eigen3_POPULATED)
-      FetchContent_Populate(Eigen3)
+      fetchcontent_populate(Eigen3)
 
       # Mark the library as IMPORTED as a workaround for https://gitlab.kitware.com/cmake/cmake/-/issues/15415
       add_library(Eigen3::Eigen INTERFACE IMPORTED)
       set_target_properties(
         Eigen3::Eigen PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${eigen3_SOURCE_DIR}"
       )
+
+      fetchcontent_getproperties(Eigen3)
+      # if(NOT Eigen3_POPULATED)
+      #   fetchcontent_populate(Eigen3)
+
+      #   # Mark the library as IMPORTED as a workaround for https://gitlab.kitware.com/cmake/cmake/-/issues/15415
+      #   add_library(Eigen3::Eigen INTERFACE IMPORTED)
+      #   set_target_properties(
+      #     Eigen3::Eigen PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${eigen3_SOURCE_DIR}"
+      #   )
+      # endif()
+    else()
+      find_package(Eigen3 REQUIRED)
     endif()
   endif()
 endif()
diff --git a/plugin/sdf/CMakeLists.txt b/plugin/sdf/CMakeLists.txt
index 3e216fc..e7e3a1e 100644
--- a/plugin/sdf/CMakeLists.txt
+++ b/plugin/sdf/CMakeLists.txt
@@ -37,7 +37,7 @@ set(MUJOCO_SDF_SRCS
 add_library(sdf SHARED)
 target_sources(sdf PRIVATE ${MUJOCO_SDF_SRCS})
 target_include_directories(sdf PRIVATE ${MUJOCO_SDF_INCLUDE})
-target_link_libraries(sdf PRIVATE mujoco SdfLib)
+target_link_libraries(sdf PRIVATE mujoco SdfLib::SdfLib)
 target_compile_options(
   sdf
   PRIVATE ${AVX_COMPILE_OPTIONS}
diff --git a/python/mujoco/util/CMakeLists.txt b/python/mujoco/util/CMakeLists.txt
index 666a372..d89bb49 100644
--- a/python/mujoco/util/CMakeLists.txt
+++ b/python/mujoco/util/CMakeLists.txt
@@ -63,8 +63,8 @@ if(BUILD_TESTING)
   target_link_libraries(
     array_traits_test
     array_traits
-    gmock
-    gtest_main
+    GTest::gmock
+    GTest::gtest_main
   )
   gtest_add_tests(TARGET array_traits_test SOURCES array_traits_test.cc)
 
@@ -72,8 +72,8 @@ if(BUILD_TESTING)
   target_link_libraries(
     func_traits_test
     func_traits
-    gmock
-    gtest_main
+    GTest::gmock
+    GTest::gtest_main
   )
   gtest_add_tests(TARGET func_traits_test SOURCES func_traits_test.cc)
 
@@ -81,8 +81,8 @@ if(BUILD_TESTING)
   target_link_libraries(
     func_wrap_test
     func_wrap
-    gmock
-    gtest_main
+    GTest::gmock
+    GTest::gtest_main
   )
   gtest_add_tests(TARGET func_wrap_test SOURCES func_wrap_test.cc)
 
@@ -90,8 +90,8 @@ if(BUILD_TESTING)
   target_link_libraries(
     tuple_tools_test
     func_wrap
-    gmock
-    gtest_main
+    GTest::gmock
+    GTest::gtest_main
   )
   gtest_add_tests(TARGET tuple_tools_test SOURCES tuple_tools_test.cc)
 endif()
diff --git a/simulate/cmake/SimulateDependencies.cmake b/simulate/cmake/SimulateDependencies.cmake
index 5141406..75ff788 100644
--- a/simulate/cmake/SimulateDependencies.cmake
+++ b/simulate/cmake/SimulateDependencies.cmake
@@ -81,10 +81,6 @@ findorfetch(
   glfw3
   LIBRARY_NAME
   glfw3
-  GIT_REPO
-  https://github.com/glfw/glfw.git
-  GIT_TAG
-  ${MUJOCO_DEP_VERSION_glfw3}
   TARGETS
   glfw
   EXCLUDE_FROM_ALL
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index 6bec911..2a16c21 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -30,7 +30,7 @@ macro(mujoco_test name)
   )
 
   add_executable(${name} ${name}.cc)
-  target_link_libraries(${name} gtest_main mujoco)
+  target_link_libraries(${name} GTest::gtest_main mujoco)
   target_include_directories(${name} PRIVATE ${MUJOCO_TEST_INCLUDE})
   set_target_properties(${name} PROPERTIES BUILD_RPATH ${CMAKE_LIBRARY_OUTPUT_DIRECTORY})
   # gtest_discover_tests is recommended over gtest_add_tests, but has some issues in Windows.
@@ -59,20 +59,20 @@ target_link_libraries(
   PUBLIC absl::core_headers
          absl::strings
          absl::synchronization
-         gtest
-         gmock
+         GTest::gtest
+         GTest::gmock
          mujoco::mujoco
 )
 target_include_directories(fixture PRIVATE ${mujoco_SOURCE_DIR}/include gmock)
 
 mujoco_test(fixture_test)
-target_link_libraries(fixture_test fixture gmock)
+target_link_libraries(fixture_test fixture GTest::gmock)
 
 mujoco_test(header_test)
-target_link_libraries(header_test fixture gmock)
+target_link_libraries(header_test fixture GTest::gmock)
 
 mujoco_test(pipeline_test)
-target_link_libraries(pipeline_test fixture gmock)
+target_link_libraries(pipeline_test fixture GTest::gmock)
 
 add_subdirectory(benchmark)
 add_subdirectory(engine)