diff options
author | Robert Maynard <robert.maynard@kitware.com> | 2019-11-29 17:07:31 (GMT) |
---|---|---|
committer | Robert Maynard <robert.maynard@kitware.com> | 2019-11-29 19:21:35 (GMT) |
commit | 5341f5e4a117c7b42f52250b9d66db2f6ca67724 (patch) | |
tree | f7d98542e0de55945a9d1a9a14cb28d14d14f999 /Modules/Compiler | |
parent | 7f15c998519d83d49b16887c4e035336378d854b (diff) | |
download | CMake-5341f5e4a117c7b42f52250b9d66db2f6ca67724.zip CMake-5341f5e4a117c7b42f52250b9d66db2f6ca67724.tar.gz CMake-5341f5e4a117c7b42f52250b9d66db2f6ca67724.tar.bz2 |
CUDA: get header deps from compiler invocation when possible
Before CUDA 10.2 `nvcc` didn't support providing header dependency
information while compiling.
Diffstat (limited to 'Modules/Compiler')
-rw-r--r-- | Modules/Compiler/NVIDIA-CUDA.cmake | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/Modules/Compiler/NVIDIA-CUDA.cmake b/Modules/Compiler/NVIDIA-CUDA.cmake index 2400a9d..2b24fa5 100644 --- a/Modules/Compiler/NVIDIA-CUDA.cmake +++ b/Modules/Compiler/NVIDIA-CUDA.cmake @@ -18,6 +18,13 @@ else() set(_CMAKE_CUDA_EXTRA_DEVICE_LINK_FLAGS "") endif() +if (NOT CMAKE_CUDA_COMPILER_VERSION VERSION_LESS 10.2) + # The -MD flag was only added to nvcc in 10.2 so + # before that we had to invoke the compiler twice + # to get header dependency information + set(CMAKE_DEPFILE_FLAGS_CUDA "-MD -MT <OBJECT> -MF <DEPFILE>") +endif() + if(NOT "x${CMAKE_CUDA_SIMULATE_ID}" STREQUAL "xMSVC") set(CMAKE_CUDA_COMPILE_OPTIONS_PIE -Xcompiler=-fPIE) set(CMAKE_CUDA_COMPILE_OPTIONS_PIC -Xcompiler=-fPIC) |