Skip to content

Commit 52fedb2

Browse files
committed
backward compatibility
1 parent dc5a78d commit 52fedb2

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

cmake/Spt3gIncludes.cmake

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,11 @@ endmacro(add_spt3g_library lib_name)
5858
macro(add_spt3g_module lib_name)
5959
set(mod_name "_lib${lib_name}")
6060
pybind11_add_module(${mod_name} MODULE WITH_SOABI ${ARGN})
61-
if (NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
62-
# Assume Linux-style ld linker
63-
target_link_options(${mod_name} PUBLIC "LINKER:--no-as-needed")
61+
# Assume Linux-style ld linker
62+
if(${CMAKE_VERSION} VERSION_GREATER_EQUAL 3.17)
63+
target_link_options(${prog_name} PUBLIC "LINKER:--no-as-needed")
64+
else()
65+
set_target_properties(${prog_name} PROPERTIES LINK_FLAGS "-Wl,--no-as-needed")
6466
endif()
6567
target_link_libraries(${mod_name} PUBLIC ${lib_name})
6668
set_target_properties(${mod_name} PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${SPT3G_MODULE_DIR})

0 commit comments

Comments
 (0)