|
|
@@ -74,15 +74,19 @@ macro(__compiler_gnu lang)
|
|
|
|
|
|
if (NOT DEFINED CMAKE_${lang}_LINKER_DEPFILE_SUPPORTED)
|
|
|
## check if this feature is supported by the linker
|
|
|
- execute_process(COMMAND "${CMAKE_${lang}_COMPILER}" -Wl,--help
|
|
|
- OUTPUT_VARIABLE _linker_capabilities
|
|
|
- ERROR_VARIABLE _linker_capabilities)
|
|
|
- if(_linker_capabilities MATCHES "--dependency-file")
|
|
|
- set(CMAKE_${lang}_LINKER_DEPFILE_SUPPORTED TRUE)
|
|
|
+ if (CMAKE_${lang}_COMPILER_LINKER AND CMAKE_${lang}_COMPILER_LINKER_ID MATCHES "GNU|LLD")
|
|
|
+ execute_process(COMMAND "${CMAKE_${lang}_COMPILER}" --help
|
|
|
+ OUTPUT_VARIABLE _linker_capabilities
|
|
|
+ ERROR_VARIABLE _linker_capabilities)
|
|
|
+ if(_linker_capabilities MATCHES "--dependency-file")
|
|
|
+ set(CMAKE_${lang}_LINKER_DEPFILE_SUPPORTED TRUE)
|
|
|
+ else()
|
|
|
+ set(CMAKE_${lang}_LINKER_DEPFILE_SUPPORTED FALSE)
|
|
|
+ endif()
|
|
|
+ unset(_linker_capabilities)
|
|
|
else()
|
|
|
set(CMAKE_${lang}_LINKER_DEPFILE_SUPPORTED FALSE)
|
|
|
endif()
|
|
|
- unset(_linker_capabilities)
|
|
|
endif()
|
|
|
endif()
|
|
|
if (CMAKE_${lang}_LINKER_DEPFILE_SUPPORTED)
|
|
|
@@ -91,11 +95,14 @@ macro(__compiler_gnu lang)
|
|
|
unset(CMAKE_${lang}_LINK_DEPENDS_USE_LINKER)
|
|
|
endif()
|
|
|
|
|
|
- # For now, due to GNU binutils ld bug when LTO is enabled (see GNU bug
|
|
|
- # `30568 <https://sourceware.org/bugzilla/show_bug.cgi?id=30568>`_),
|
|
|
- # deactivate this feature.
|
|
|
- if (NOT DEFINED CMAKE_LINK_DEPENDS_USE_LINKER)
|
|
|
- set(CMAKE_LINK_DEPENDS_USE_LINKER FALSE)
|
|
|
+ # Due to GNU binutils ld bug when LTO is enabled (see GNU bug
|
|
|
+ # `30568 <https://sourceware.org/bugzilla/show_bug.cgi?id=30568>`_),
|
|
|
+ # deactivate this feature if the version is less than 2.41.
|
|
|
+ # For now, all known versions of gold linker have also this bug.
|
|
|
+ if (CMAKE_${lang}_COMPILER_LINKER_ID STREQUAL "GNUgold"
|
|
|
+ OR (CMAKE_${lang}_COMPILER_LINKER_ID STREQUAL "GNU"
|
|
|
+ AND CMAKE_${lang}_COMPILER_LINKER_VERSION VERSION_LESS "2.41"))
|
|
|
+ set(CMAKE_${lang}_LINK_DEPENDS_USE_LINKER FALSE)
|
|
|
endif()
|
|
|
|
|
|
# Initial configuration flags.
|