Skip to content
This repository was archived by the owner on Mar 20, 2023. It is now read-only.

Commit bbed7dc

Browse files
committed
Respect CMAKE_EXE_LINKER_FLAGS/CMAKE_SHARED_LINKER_FLAGS flags set via CLI
In case of Clang, we were always overriding the above mentioned flags and hence cmake args were ignored (resuliting in link errors)
1 parent 5379663 commit bbed7dc

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

CMake/config/CompilerFlagsHelpers.cmake

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,8 @@ foreach(COMPILER_LANGUAGE ${SUPPORTED_COMPILER_LANGUAGE_LIST})
113113
# Force same ld behavior as when called from gcc --as-needed forces the linker to check whether
114114
# a dynamic library mentioned in the command line is actually needed by the objects being
115115
# linked. Symbols needed in shared objects are already linked when building that library.
116-
set(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed")
117-
set(CMAKE_SHARED_LINKER_FLAGS "-Wl,--as-needed")
116+
set(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed ${CMAKE_EXE_LINKER_FLAGS}")
117+
set(CMAKE_SHARED_LINKER_FLAGS "-Wl,--as-needed ${CMAKE_SHARED_LINKER_FLAGS}")
118118

119119
# rest of the world
120120
else()

0 commit comments

Comments
 (0)