Skip to content

Commit

Permalink
Cmake: pass 'undefined' with double dash so alternative linker can be…
Browse files Browse the repository at this point in the history
… used
  • Loading branch information
0penBrain committed Mar 8, 2024
1 parent eb5a1b3 commit 261e651
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions cMake/FreeCAD_Helpers/CompilerChecksAndSetups.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,13 @@ macro(CompilerChecksAndSetups)
# get linker errors as soon as possible and not at runtime e.g. for modules
if(BUILD_DYNAMIC_LINK_PYTHON)
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-undefined,error")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--undefined,error")
elseif(UNIX)
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--no-undefined")
endif()
else(BUILD_DYNAMIC_LINK_PYTHON)
if(CMAKE_COMPILER_IS_CLANGXX)
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-undefined,dynamic_lookup")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--undefined,dynamic_lookup")
endif()
endif(BUILD_DYNAMIC_LINK_PYTHON)
endif(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_CLANGXX)
Expand Down
2 changes: 1 addition & 1 deletion src/Mod/Path/libarea/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ target_link_libraries(area area-native ${area_LIBS} ${area_native_LIBS})
# TODO why CMAKE_SHARED_LINKER_FLAGS is not used here?
# This is a dirty workaround!
if(NOT BUILD_DYNAMIC_LINK_PYTHON AND CMAKE_COMPILER_IS_CLANGXX)
target_link_libraries(area "-Wl,-undefined,dynamic_lookup")
target_link_libraries(area "-Wl,--undefined,dynamic_lookup")
endif()

SET_BIN_DIR(area area /Mod/Path)
Expand Down

0 comments on commit 261e651

Please sign in to comment.