1
0
Эх сурвалжийг харах

Link Step: ensure the correct linker is used for depfile configuration

This is related to MR !8443.
Marc Chevrier 2 жил өмнө
parent
commit
0626b62cf2

+ 1 - 1
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@

+ 1 - 1
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@")

+ 1 - 1
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@")

+ 1 - 1
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@")

+ 1 - 1
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()

+ 1 - 1
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@")

+ 1 - 1
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)

+ 1 - 1
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@")

+ 0 - 8
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)
 

+ 3 - 2
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)