Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion Source/cmake/OptionsCommon.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,15 @@ else ()
set(LD_SUPPORTS_THIN_ARCHIVES FALSE)
set(LD_SUPPORTS_DISABLE_NEW_DTAGS FALSE)
endif ()

if (LD_SUPPORTS_DISABLE_NEW_DTAGS)
set(DISABLE_NEW_DTAGS_DEFAULT ON)
else ()
set(DISABLE_NEW_DTAGS_DEFAULT OFF)
endif ()

option(DISABLE_NEW_DTAGS "Disable new dtags" ${DISABLE_NEW_DTAGS_DEFAULT})

unset(LD_VERSION)
message(STATUS "Linker variant in use: ${LD_VARIANT} ")
message(STATUS " Linker supports thin archives - ${LD_SUPPORTS_THIN_ARCHIVES}")
Expand Down Expand Up @@ -112,10 +121,14 @@ message(STATUS " Archiver supports thin archives - ${AR_SUPPORTS_THIN_ARCHIVES}
# passing the option DT_RUNPATH is used, which can be overriden by the value
# of LD_LIBRARY_PATH set in the environment, resulting in unexpected behaviour
# for developers.
if (LD_SUPPORTS_DISABLE_NEW_DTAGS)
if (DISABLE_NEW_DTAGS)
string(APPEND CMAKE_EXE_LINKER_FLAGS " -Wl,--disable-new-dtags")
string(APPEND CMAKE_SHARED_LINKER_FLAGS " -Wl,--disable-new-dtags")
string(APPEND CMAKE_MODULE_LINKER_FLAGS " -Wl,--disable-new-dtags")
else ()
string(APPEND CMAKE_EXE_LINKER_FLAGS " -Wl,--enable-new-dtags")
string(APPEND CMAKE_SHARED_LINKER_FLAGS " -Wl,--enable-new-dtags")
string(APPEND CMAKE_MODULE_LINKER_FLAGS " -Wl,--enable-new-dtags")
endif ()

# Prefer thin archives by default if they can be both created by the
Expand Down