diff options
author | Marc Chevrier <marc.chevrier@gmail.com> | 2023-05-27 14:41:56 (GMT) |
---|---|---|
committer | Marc Chevrier <marc.chevrier@gmail.com> | 2023-05-28 09:28:08 (GMT) |
commit | 0626b62cf2c7a10c789f2e1b9543f0adac2e2c53 (patch) | |
tree | 98fa06b17f015b52d797734feb9f0163f76b3ad4 /Modules/Compiler/GNU.cmake | |
parent | 5d39aad169f9e9258bf8ac34dd4b5ae66dc24f20 (diff) | |
download | CMake-0626b62cf2c7a10c789f2e1b9543f0adac2e2c53.zip CMake-0626b62cf2c7a10c789f2e1b9543f0adac2e2c53.tar.gz CMake-0626b62cf2c7a10c789f2e1b9543f0adac2e2c53.tar.bz2 |
Link Step: ensure the correct linker is used for depfile configuration
This is related to MR !8443.
Diffstat (limited to 'Modules/Compiler/GNU.cmake')
-rw-r--r-- | Modules/Compiler/GNU.cmake | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/Modules/Compiler/GNU.cmake b/Modules/Compiler/GNU.cmake index f140208..251e05a 100644 --- a/Modules/Compiler/GNU.cmake +++ b/Modules/Compiler/GNU.cmake @@ -53,7 +53,7 @@ macro(__compiler_gnu lang) endif() # define flags for linker depfile generation - if (NOT DEFINED CMAKE_${lang}_LINKER_DEPFILE_SUPPORTED) + if(NOT DEFINED CMAKE_${lang}_LINKER_DEPFILE_SUPPORTED) ## Ensure ninja tool is recent enough... if(CMAKE_GENERATOR MATCHES "^Ninja") # Ninja 1.10 or upper is required @@ -71,7 +71,7 @@ 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_LINKER}" --help + execute_process(COMMAND "${CMAKE_${lang}_COMPILER}" -Wl,--help OUTPUT_VARIABLE _linker_capabilities ERROR_VARIABLE _linker_capabilities) if(_linker_capabilities MATCHES "--dependency-file") @@ -82,6 +82,7 @@ macro(__compiler_gnu lang) unset(_linker_capabilities) endif() endif() + if (CMAKE_${lang}_LINKER_DEPFILE_SUPPORTED) set(CMAKE_${lang}_LINKER_DEPFILE_FLAGS "LINKER:--dependency-file,<DEP_FILE>") set(CMAKE_${lang}_LINKER_DEPFILE_FORMAT gcc) |