summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2020-05-14 17:34:58 (GMT)
committerRaul Tambre <raul@tambre.ee>2020-05-15 14:46:51 (GMT)
commit70be10cbf4091f873e51937dd6013182fc2740d4 (patch)
tree5945f31de320b54b34ac5a29785e29d997aef4d8 /Modules
parent1bdbd4651a60031975021ad62f883b30fb7a5d4e (diff)
downloadCMake-70be10cbf4091f873e51937dd6013182fc2740d4.zip
CMake-70be10cbf4091f873e51937dd6013182fc2740d4.tar.gz
CMake-70be10cbf4091f873e51937dd6013182fc2740d4.tar.bz2
CUDA: Remove toolkit include dirs from implicit include dirs only with NVIDIA
The special case added by commit 87df637078 (CUDA: Do not treat CUDA toolkit include directories as implicit, 2020-02-02, v3.17.0-rc1~31^2) breaks CMake's protections against changing the compiler's implicit include directory order. Do this only for the NVIDIA compiler where it is needed as a workaround to another problem. That compiler does not put the host compiler's implicit include directories in `-I` paths so we do not detect them as `CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES` anyway.
Diffstat (limited to 'Modules')
-rw-r--r--Modules/CMakeTestCUDACompiler.cmake22
1 files changed, 12 insertions, 10 deletions
diff --git a/Modules/CMakeTestCUDACompiler.cmake b/Modules/CMakeTestCUDACompiler.cmake
index 05811a8..5ad7257 100644
--- a/Modules/CMakeTestCUDACompiler.cmake
+++ b/Modules/CMakeTestCUDACompiler.cmake
@@ -78,16 +78,18 @@ else()
list(REMOVE_ITEM CMAKE_CUDA_IMPLICIT_LINK_LIBRARIES cudart cudart_static cudadevrt)
list(REMOVE_ITEM CMAKE_CUDA_HOST_IMPLICIT_LINK_LIBRARIES cudart cudart_static cudadevrt)
- # Remove the CUDA Toolkit include directories from the set of
- # implicit system include directories.
- # This resolves the issue that NVCC doesn't specify these
- # includes as SYSTEM includes when compiling device code, and sometimes
- # they contain headers that generate warnings, so let users mark them
- # as SYSTEM explicitly
- if(CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES)
- list(REMOVE_ITEM CMAKE_CUDA_IMPLICIT_INCLUDE_DIRECTORIES
- ${CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES}
- )
+ if(CMAKE_CUDA_COMPILER_ID STREQUAL "NVIDIA")
+ # Remove the CUDA Toolkit include directories from the set of
+ # implicit system include directories.
+ # This resolves the issue that NVCC doesn't specify these
+ # includes as SYSTEM includes when compiling device code, and sometimes
+ # they contain headers that generate warnings, so let users mark them
+ # as SYSTEM explicitly
+ if(CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES)
+ list(REMOVE_ITEM CMAKE_CUDA_IMPLICIT_INCLUDE_DIRECTORIES
+ ${CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES}
+ )
+ endif()
endif()
# Re-configure to save learned information.