Skip to content

Commit 78e04f6

Browse files
Fix --gc-sections linking error on github macos-15-x86_64.
This forces `CMAKE_REQUIRED_FLAGS` to be treated as a string instead of list, so none of the args get dropped when passed through `check_c_source_compiles`. PiperOrigin-RevId: 886717366 Change-Id: I43104d73aa2185a6e2f359cf4195d05d547020b5
1 parent 5361527 commit 78e04f6

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

cmake/MujocoLinkOptions.cmake

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,12 @@ function(get_mujoco_extra_link_options OUTPUT_VAR)
4343
endif()
4444
endif()
4545

46-
set(CMAKE_REQUIRED_FLAGS ${EXTRA_LINK_OPTIONS} "-Wl,--gc-sections")
46+
set(CMAKE_REQUIRED_FLAGS "${EXTRA_LINK_OPTIONS} -Wl,--gc-sections")
4747
check_c_source_compiles("int main() {}" SUPPORTS_GC_SECTIONS)
4848
if(SUPPORTS_GC_SECTIONS)
4949
set(EXTRA_LINK_OPTIONS ${EXTRA_LINK_OPTIONS} -Wl,--gc-sections)
5050
else()
51-
set(CMAKE_REQUIRED_FLAGS ${EXTRA_LINK_OPTIONS} "-Wl,-dead_strip")
51+
set(CMAKE_REQUIRED_FLAGS "${EXTRA_LINK_OPTIONS} -Wl,-dead_strip")
5252
check_c_source_compiles("int main() {}" SUPPORTS_DEAD_STRIP)
5353
if(SUPPORTS_DEAD_STRIP)
5454
set(EXTRA_LINK_OPTIONS ${EXTRA_LINK_OPTIONS} -Wl,-dead_strip)

0 commit comments

Comments
 (0)