diff options
author | Robert Maynard <robert.maynard@kitware.com> | 2020-02-03 03:07:14 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2020-02-03 19:59:26 (GMT) |
commit | 87df63707859d69a91764b4d491aaec7bec8d312 (patch) | |
tree | d5a270430ae3afab06e38bb55366a9adfad8f13a /Modules/CMakeTestCUDACompiler.cmake | |
parent | 3a732a7dc3a2f48f824175ad4727706a14974929 (diff) | |
download | CMake-87df63707859d69a91764b4d491aaec7bec8d312.zip CMake-87df63707859d69a91764b4d491aaec7bec8d312.tar.gz CMake-87df63707859d69a91764b4d491aaec7bec8d312.tar.bz2 |
CUDA: Do not treat CUDA toolkit include directories as implicit
CMake properly detects the toolkit directories as implicit system
includes, but CUDA compilers don't add explicit `-isystem` markups to
these directories when compiling CUDA code. Due to this limitation,
allow users to explicitly specify these directories as SYSTEM dirs.
Fixes: #16464, #19864
Diffstat (limited to 'Modules/CMakeTestCUDACompiler.cmake')
-rw-r--r-- | Modules/CMakeTestCUDACompiler.cmake | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/Modules/CMakeTestCUDACompiler.cmake b/Modules/CMakeTestCUDACompiler.cmake index d80b55a..05811a8 100644 --- a/Modules/CMakeTestCUDACompiler.cmake +++ b/Modules/CMakeTestCUDACompiler.cmake @@ -78,6 +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} + ) + endif() + # Re-configure to save learned information. configure_file( ${CMAKE_ROOT}/Modules/CMakeCUDACompiler.cmake.in |