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 | |
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')
-rw-r--r-- | Modules/CMakeASMCompiler.cmake.in | 2 | ||||
-rw-r--r-- | Modules/CMakeCCompiler.cmake.in | 2 | ||||
-rw-r--r-- | Modules/CMakeCUDACompiler.cmake.in | 2 | ||||
-rw-r--r-- | Modules/CMakeCXXCompiler.cmake.in | 2 | ||||
-rw-r--r-- | Modules/CMakeFortranCompiler.cmake.in | 2 | ||||
-rw-r--r-- | Modules/CMakeHIPCompiler.cmake.in | 2 | ||||
-rw-r--r-- | Modules/CMakeOBJCCompiler.cmake.in | 2 | ||||
-rw-r--r-- | Modules/CMakeOBJCXXCompiler.cmake.in | 2 | ||||
-rw-r--r-- | Modules/Compiler/Clang-HIP.cmake | 8 | ||||
-rw-r--r-- | Modules/Compiler/GNU.cmake | 5 |
10 files changed, 11 insertions, 18 deletions
diff --git a/Modules/CMakeASMCompiler.cmake.in b/Modules/CMakeASMCompiler.cmake.in index 8a1718b..1efd9f5 100644 --- a/Modules/CMakeASMCompiler.cmake.in +++ b/Modules/CMakeASMCompiler.cmake.in @@ -17,6 +17,6 @@ set(CMAKE_ASM@ASM_DIALECT@_COMPILER_ENV_VAR "@_CMAKE_ASM_COMPILER_ENV_VAR@") set(CMAKE_ASM@ASM_DIALECT@_IGNORE_EXTENSIONS h;H;o;O;obj;OBJ;def;DEF;rc;RC) set(CMAKE_ASM@ASM_DIALECT@_LINKER_PREFERENCE 0) -set(CMAKE_ASM@ASM_DIALECT@_LINKER_DEPFILE_SUPPORTED "@CMAKE_ASM_LINKER_DEPFILE_SUPPORTED@") +set(CMAKE_ASM@ASM_DIALECT@_LINKER_DEPFILE_SUPPORTED @CMAKE_ASM_LINKER_DEPFILE_SUPPORTED@) @CMAKE_ASM_COMPILER_CUSTOM_CODE@ diff --git a/Modules/CMakeCCompiler.cmake.in b/Modules/CMakeCCompiler.cmake.in index cf3a242..2f0b774 100644 --- a/Modules/CMakeCCompiler.cmake.in +++ b/Modules/CMakeCCompiler.cmake.in @@ -39,7 +39,7 @@ set(CMAKE_C_COMPILER_ID_RUN 1) set(CMAKE_C_SOURCE_FILE_EXTENSIONS c;m) set(CMAKE_C_IGNORE_EXTENSIONS h;H;o;O;obj;OBJ;def;DEF;rc;RC) set(CMAKE_C_LINKER_PREFERENCE 10) -set(CMAKE_C_LINKER_DEPFILE_SUPPORTED "@CMAKE_C_LINKER_DEPFILE_SUPPORTED@") +set(CMAKE_C_LINKER_DEPFILE_SUPPORTED @CMAKE_C_LINKER_DEPFILE_SUPPORTED@) # Save compiler ABI information. set(CMAKE_C_SIZEOF_DATA_PTR "@CMAKE_C_SIZEOF_DATA_PTR@") diff --git a/Modules/CMakeCUDACompiler.cmake.in b/Modules/CMakeCUDACompiler.cmake.in index 3d7d552..3c28c28 100644 --- a/Modules/CMakeCUDACompiler.cmake.in +++ b/Modules/CMakeCUDACompiler.cmake.in @@ -30,7 +30,7 @@ set(CMAKE_CUDA_COMPILER_ID_RUN 1) set(CMAKE_CUDA_SOURCE_FILE_EXTENSIONS cu) set(CMAKE_CUDA_LINKER_PREFERENCE 15) set(CMAKE_CUDA_LINKER_PREFERENCE_PROPAGATES 1) -set(CMAKE_CUDA_LINKER_DEPFILE_SUPPORTED "@CMAKE_CUDA_LINKER_DEPFILE_SUPPORTED@") +set(CMAKE_CUDA_LINKER_DEPFILE_SUPPORTED @CMAKE_CUDA_LINKER_DEPFILE_SUPPORTED@) set(CMAKE_CUDA_SIZEOF_DATA_PTR "@CMAKE_CUDA_SIZEOF_DATA_PTR@") set(CMAKE_CUDA_COMPILER_ABI "@CMAKE_CUDA_COMPILER_ABI@") diff --git a/Modules/CMakeCXXCompiler.cmake.in b/Modules/CMakeCXXCompiler.cmake.in index 2052e7f..8b6f82b 100644 --- a/Modules/CMakeCXXCompiler.cmake.in +++ b/Modules/CMakeCXXCompiler.cmake.in @@ -50,7 +50,7 @@ endforeach() set(CMAKE_CXX_LINKER_PREFERENCE 30) set(CMAKE_CXX_LINKER_PREFERENCE_PROPAGATES 1) -set(CMAKE_CXX_LINKER_DEPFILE_SUPPORTED "@CMAKE_CXX_LINKER_DEPFILE_SUPPORTED@") +set(CMAKE_CXX_LINKER_DEPFILE_SUPPORTED @CMAKE_CXX_LINKER_DEPFILE_SUPPORTED@) # Save compiler ABI information. set(CMAKE_CXX_SIZEOF_DATA_PTR "@CMAKE_CXX_SIZEOF_DATA_PTR@") diff --git a/Modules/CMakeFortranCompiler.cmake.in b/Modules/CMakeFortranCompiler.cmake.in index a7caf2b..6a2be28 100644 --- a/Modules/CMakeFortranCompiler.cmake.in +++ b/Modules/CMakeFortranCompiler.cmake.in @@ -29,7 +29,7 @@ set(CMAKE_Fortran_COMPILER_ID_RUN 1) set(CMAKE_Fortran_SOURCE_FILE_EXTENSIONS f;F;fpp;FPP;f77;F77;f90;F90;for;For;FOR;f95;F95;f03;F03;f08;F08@CMAKE_Fortran_VENDOR_SOURCE_FILE_EXTENSIONS@) set(CMAKE_Fortran_IGNORE_EXTENSIONS h;H;o;O;obj;OBJ;def;DEF;rc;RC) set(CMAKE_Fortran_LINKER_PREFERENCE 20) -set(CMAKE_Fortran_LINKER_DEPFILE_SUPPORTED "@CMAKE_Fortran_LINKER_DEPFILE_SUPPORTED@") +set(CMAKE_Fortran_LINKER_DEPFILE_SUPPORTED @CMAKE_Fortran_LINKER_DEPFILE_SUPPORTED@) if(UNIX) set(CMAKE_Fortran_OUTPUT_EXTENSION .o) else() diff --git a/Modules/CMakeHIPCompiler.cmake.in b/Modules/CMakeHIPCompiler.cmake.in index 32c1223..c94153b 100644 --- a/Modules/CMakeHIPCompiler.cmake.in +++ b/Modules/CMakeHIPCompiler.cmake.in @@ -26,7 +26,7 @@ set(CMAKE_HIP_COMPILER_ID_RUN 1) set(CMAKE_HIP_SOURCE_FILE_EXTENSIONS hip) set(CMAKE_HIP_LINKER_PREFERENCE 90) set(CMAKE_HIP_LINKER_PREFERENCE_PROPAGATES 1) -set(CMAKE_HIP_LINKER_DEPFILE_SUPPORTED "@CMAKE_HIP_LINKER_DEPFILE_SUPPORTED@") +set(CMAKE_HIP_LINKER_DEPFILE_SUPPORTED @CMAKE_HIP_LINKER_DEPFILE_SUPPORTED@) set(CMAKE_HIP_SIZEOF_DATA_PTR "@CMAKE_HIP_SIZEOF_DATA_PTR@") set(CMAKE_HIP_COMPILER_ABI "@CMAKE_HIP_COMPILER_ABI@") diff --git a/Modules/CMakeOBJCCompiler.cmake.in b/Modules/CMakeOBJCCompiler.cmake.in index 0ceb804..de73645 100644 --- a/Modules/CMakeOBJCCompiler.cmake.in +++ b/Modules/CMakeOBJCCompiler.cmake.in @@ -37,7 +37,7 @@ set(CMAKE_OBJC_COMPILER_ID_RUN 1) set(CMAKE_OBJC_SOURCE_FILE_EXTENSIONS m) set(CMAKE_OBJC_IGNORE_EXTENSIONS h;H;o;O) set(CMAKE_OBJC_LINKER_PREFERENCE 5) -set(CMAKE_OBJC_LINKER_DEPFILE_SUPPORTED "@CMAKE_OBJC_LINKER_DEPFILE_SUPPORTED@") +set(CMAKE_OBJC_LINKER_DEPFILE_SUPPORTED @CMAKE_OBJC_LINKER_DEPFILE_SUPPORTED@) foreach (lang C CXX OBJCXX) foreach(extension IN LISTS CMAKE_OBJC_SOURCE_FILE_EXTENSIONS) diff --git a/Modules/CMakeOBJCXXCompiler.cmake.in b/Modules/CMakeOBJCXXCompiler.cmake.in index f087ec3..94d24ff 100644 --- a/Modules/CMakeOBJCXXCompiler.cmake.in +++ b/Modules/CMakeOBJCXXCompiler.cmake.in @@ -54,7 +54,7 @@ endforeach() set(CMAKE_OBJCXX_LINKER_PREFERENCE 25) set(CMAKE_OBJCXX_LINKER_PREFERENCE_PROPAGATES 1) -set(CMAKE_OBJCXX_LINKER_DEPFILE_SUPPORTED "@CMAKE_OBJCXX_LINKER_DEPFILE_SUPPORTED@") +set(CMAKE_OBJCXX_LINKER_DEPFILE_SUPPORTED @CMAKE_OBJCXX_LINKER_DEPFILE_SUPPORTED@) # Save compiler ABI information. set(CMAKE_OBJCXX_SIZEOF_DATA_PTR "@CMAKE_OBJCXX_SIZEOF_DATA_PTR@") diff --git a/Modules/Compiler/Clang-HIP.cmake b/Modules/Compiler/Clang-HIP.cmake index 7e3c99c..92925f1 100644 --- a/Modules/Compiler/Clang-HIP.cmake +++ b/Modules/Compiler/Clang-HIP.cmake @@ -1,13 +1,5 @@ include(Compiler/Clang) -# -# For now, deactivate globally linker dependency file support because -# HIP compiler is based on Clang which provides support of other languages -# -foreach (lang IN ITEMS "C" "CXX" "OBJC" "OBJCXX" "Fortran" "ASM") - set(CMAKE_${lang}_LINKER_DEPFILE_SUPPORTED FALSE) -endforeach() - __compiler_clang(HIP) __compiler_clang_cxx_standards(HIP) 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) |