diff options
author | Brad King <brad.king@kitware.com> | 2021-04-08 11:46:08 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2021-04-08 11:46:15 (GMT) |
commit | c3fab3e62d9cb044c7d716feefb703039ef7715f (patch) | |
tree | ef388db8ba4339f73b4fedaee8b609b9bbc780d4 | |
parent | 1c3ea347154d06e22f4dee91ba0afe75d9943dc0 (diff) | |
parent | 8e38985db7cb2c66f7fe74919e03e3f3ae0d0c41 (diff) | |
download | CMake-c3fab3e62d9cb044c7d716feefb703039ef7715f.zip CMake-c3fab3e62d9cb044c7d716feefb703039ef7715f.tar.gz CMake-c3fab3e62d9cb044c7d716feefb703039ef7715f.tar.bz2 |
Merge topic 'cuda-depfile-ccbin'
8e38985db7 Makefiles: Fix dependency extraction with CUDA < 10.2 and host compiler
Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Raul Tambre <raul@tambre.ee>
Acked-by: Robert Maynard <robertjmaynard@gmail.com>
Merge-request: !5992
-rw-r--r-- | Modules/CMakeCUDAInformation.cmake | 3 | ||||
-rw-r--r-- | Modules/Compiler/NVIDIA-CUDA.cmake | 10 |
2 files changed, 12 insertions, 1 deletions
diff --git a/Modules/CMakeCUDAInformation.cmake b/Modules/CMakeCUDAInformation.cmake index 2b7d7b2..44e2c2c 100644 --- a/Modules/CMakeCUDAInformation.cmake +++ b/Modules/CMakeCUDAInformation.cmake @@ -111,6 +111,9 @@ include(CMakeCommonLanguageInclude) # CMAKE_CUDA_LINK_EXECUTABLE if(CMAKE_CUDA_HOST_COMPILER AND CMAKE_CUDA_COMPILER_ID STREQUAL "NVIDIA") + # FIXME: This is too late for the Platform/Windows-NVIDIA-CUDA module to + # see it, so we do not support CMAKE_CUDA_HOST_COMPILER on Windows. + # Move this to Compiler/NVIDIA-CUDA and update the VS generator too. string(APPEND _CMAKE_CUDA_EXTRA_FLAGS " -ccbin=<CMAKE_CUDA_HOST_COMPILER>") endif() diff --git a/Modules/Compiler/NVIDIA-CUDA.cmake b/Modules/Compiler/NVIDIA-CUDA.cmake index eb80675..a0f7c05 100644 --- a/Modules/Compiler/NVIDIA-CUDA.cmake +++ b/Modules/Compiler/NVIDIA-CUDA.cmake @@ -30,7 +30,15 @@ if (CMAKE_CUDA_COMPILER_VERSION VERSION_GREATER_EQUAL 10.2.89) # to get header dependency information set(CMAKE_DEPFILE_FLAGS_CUDA "-MD -MT <DEP_TARGET> -MF <DEP_FILE>") else() - set(CMAKE_CUDA_DEPENDS_EXTRA_COMMANDS "<CMAKE_CUDA_COMPILER> ${_CMAKE_CUDA_EXTRA_FLAGS} <DEFINES> <INCLUDES> <FLAGS> ${_CMAKE_COMPILE_AS_CUDA_FLAG} -M <SOURCE> -MT <OBJECT> -o <DEP_FILE>") + if(CMAKE_CUDA_HOST_COMPILER AND NOT CMAKE_SYSTEM_NAME STREQUAL "Windows") + # FIXME: Move the main -ccbin= flag from CMakeCUDAInformation to + # a block above, remove this copy, and update the VS generator too. + set(_CMAKE_CUDA_EXTRA_FLAGS_LOCAL " -ccbin=<CMAKE_CUDA_HOST_COMPILER>") + else() + set(_CMAKE_CUDA_EXTRA_FLAGS_LOCAL "") + endif() + set(CMAKE_CUDA_DEPENDS_EXTRA_COMMANDS "<CMAKE_CUDA_COMPILER> ${_CMAKE_CUDA_EXTRA_FLAGS}${_CMAKE_CUDA_EXTRA_FLAGS_LOCAL} <DEFINES> <INCLUDES> <FLAGS> ${_CMAKE_COMPILE_AS_CUDA_FLAG} -M <SOURCE> -MT <OBJECT> -o <DEP_FILE>") + unset(_CMAKE_CUDA_EXTRA_FLAGS_LOCAL) endif() set(CMAKE_CUDA_DEPFILE_FORMAT gcc) if((NOT DEFINED CMAKE_DEPENDS_USE_COMPILER OR CMAKE_DEPENDS_USE_COMPILER) |