@@ -71,6 +71,15 @@ else ()
7171 set (LD_SUPPORTS_THIN_ARCHIVES FALSE )
7272 set (LD_SUPPORTS_DISABLE_NEW_DTAGS FALSE )
7373endif ()
74+
75+ if (LD_SUPPORTS_DISABLE_NEW_DTAGS)
76+ set (DISABLE_NEW_DTAGS_DEFAULT ON )
77+ else ()
78+ set (DISABLE_NEW_DTAGS_DEFAULT OFF )
79+ endif ()
80+
81+ option (DISABLE_NEW_DTAGS "Disable new dtags" ${DISABLE_NEW_DTAGS_DEFAULT} )
82+
7483unset (LD_VERSION)
7584message (STATUS "Linker variant in use: ${LD_VARIANT} " )
7685message (STATUS " Linker supports thin archives - ${LD_SUPPORTS_THIN_ARCHIVES} " )
@@ -112,10 +121,14 @@ message(STATUS " Archiver supports thin archives - ${AR_SUPPORTS_THIN_ARCHIVES}
112121# passing the option DT_RUNPATH is used, which can be overriden by the value
113122# of LD_LIBRARY_PATH set in the environment, resulting in unexpected behaviour
114123# for developers.
115- if (LD_SUPPORTS_DISABLE_NEW_DTAGS )
124+ if (DISABLE_NEW_DTAGS )
116125 string (APPEND CMAKE_EXE_LINKER_FLAGS " -Wl,--disable-new-dtags" )
117126 string (APPEND CMAKE_SHARED_LINKER_FLAGS " -Wl,--disable-new-dtags" )
118127 string (APPEND CMAKE_MODULE_LINKER_FLAGS " -Wl,--disable-new-dtags" )
128+ else ()
129+ string (APPEND CMAKE_EXE_LINKER_FLAGS " -Wl,--enable-new-dtags" )
130+ string (APPEND CMAKE_SHARED_LINKER_FLAGS " -Wl,--enable-new-dtags" )
131+ string (APPEND CMAKE_MODULE_LINKER_FLAGS " -Wl,--enable-new-dtags" )
119132endif ()
120133
121134# Prefer thin archives by default if they can be both created by the
0 commit comments