summaryrefslogtreecommitdiffstats
path: root/Modules/Internal/CMakeNVCCFilterImplicitInfo.cmake
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2023-09-15 18:10:51 (GMT)
committerBrad King <brad.king@kitware.com>2023-09-21 19:34:27 (GMT)
commitdeff0e638d2a6308354c0bdbc2c262d525218e64 (patch)
tree0c2bfd19b6738df771bb6f26a3bd10e8848320ec /Modules/Internal/CMakeNVCCFilterImplicitInfo.cmake
parente1b2a5062f0c45da3cc69055825e9aad4fffbf32 (diff)
downloadCMake-deff0e638d2a6308354c0bdbc2c262d525218e64.zip
CMake-deff0e638d2a6308354c0bdbc2c262d525218e64.tar.gz
CMake-deff0e638d2a6308354c0bdbc2c262d525218e64.tar.bz2
CUDA: Factor out helper to parse NVCC implicit compiler and linker flags
Prepare to use it for other languages.
Diffstat (limited to 'Modules/Internal/CMakeNVCCFilterImplicitInfo.cmake')
-rw-r--r--Modules/Internal/CMakeNVCCFilterImplicitInfo.cmake16
1 files changed, 16 insertions, 0 deletions
diff --git a/Modules/Internal/CMakeNVCCFilterImplicitInfo.cmake b/Modules/Internal/CMakeNVCCFilterImplicitInfo.cmake
new file mode 100644
index 0000000..dee7580
--- /dev/null
+++ b/Modules/Internal/CMakeNVCCFilterImplicitInfo.cmake
@@ -0,0 +1,16 @@
+# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+# file Copyright.txt or https://cmake.org/licensing for details.
+
+macro(cmake_nvcc_filter_implicit_info lang lang_var_)
+ # 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(${lang_var_}TOOLKIT_INCLUDE_DIRECTORIES)
+ list(REMOVE_ITEM CMAKE_${lang}_IMPLICIT_INCLUDE_DIRECTORIES
+ ${${lang_var_}TOOLKIT_INCLUDE_DIRECTORIES}
+ )
+ endif()
+endmacro()