From d0e52219eb1c8a614bbb416f73c932b7858292f8 Mon Sep 17 00:00:00 2001 From: Robert Maynard Date: Fri, 14 Oct 2022 14:06:38 -0400 Subject: CUDA: Revert "Always mark cuda toolkit as system include" We need to revert this change as it can disable error messages when compiling invalid CUDA code. This reverts commit ea659b155d (CUDA: Always mark cuda toolkit as system include, 2022-06-27, v3.25.0-rc1~269^2). --- Modules/CMakeTestCUDACompiler.cmake | 6 ++++-- Source/cmGlobalGenerator.cxx | 9 --------- Tests/CudaOnly/CMakeLists.txt | 6 ++---- Tests/CudaOnly/ToolkitIsSystemInclude/CMakeLists.txt | 7 ------- Tests/CudaOnly/ToolkitIsSystemInclude/include/nvrtc.h | 5 ----- Tests/CudaOnly/ToolkitIsSystemInclude/main.cu | 4 ---- 6 files changed, 6 insertions(+), 31 deletions(-) delete mode 100644 Tests/CudaOnly/ToolkitIsSystemInclude/CMakeLists.txt delete mode 100644 Tests/CudaOnly/ToolkitIsSystemInclude/include/nvrtc.h delete mode 100644 Tests/CudaOnly/ToolkitIsSystemInclude/main.cu diff --git a/Modules/CMakeTestCUDACompiler.cmake b/Modules/CMakeTestCUDACompiler.cmake index a89182b..f2fa6ea 100644 --- a/Modules/CMakeTestCUDACompiler.cmake +++ b/Modules/CMakeTestCUDACompiler.cmake @@ -127,8 +127,10 @@ list(REMOVE_ITEM CMAKE_CUDA_IMPLICIT_LINK_LIBRARIES ${CMAKE_CUDA_IMPLICIT_LINK_L if(CMAKE_CUDA_COMPILER_ID STREQUAL "NVIDIA") # Remove the CUDA Toolkit include directories from the set of # implicit system include directories. - # CMake will explicitly mark these as SYSTEM to NVCC since it implicitly - # adds them as user includes and not system + # 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} diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 6962b52..c2bf888 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -1855,15 +1855,6 @@ void cmGlobalGenerator::FinalizeTargetConfiguration() cmExpandedList(standardIncludesStr); standardIncludesSet.insert(standardIncludesVec.begin(), standardIncludesVec.end()); - if (li == "CUDA") { - std::string const& cudaSystemIncludeVar = - mf->GetSafeDefinition("CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES"); - std::vector cudaToolkitIncludeVec = - cmExpandedList(cudaSystemIncludeVar); - standardIncludesSet.insert(cudaToolkitIncludeVec.begin(), - cudaToolkitIncludeVec.end()); - mf->AddIncludeDirectories(cudaToolkitIncludeVec); - } } mf->AddSystemIncludeDirectories(standardIncludesSet); } diff --git a/Tests/CudaOnly/CMakeLists.txt b/Tests/CudaOnly/CMakeLists.txt index d23e929..091872d 100644 --- a/Tests/CudaOnly/CMakeLists.txt +++ b/Tests/CudaOnly/CMakeLists.txt @@ -27,12 +27,10 @@ if(CMake_TEST_CUDA AND NOT CMake_TEST_CUDA STREQUAL "Clang") add_cuda_test_macro(CudaOnly.GPUDebugFlag CudaOnlyGPUDebugFlag) endif() +# The CUDA only ships the shared version of the toolkit libraries +# on windows if(NOT WIN32) - # The CUDA only ships the shared version of the toolkit libraries - # on windows add_cuda_test_macro(CudaOnly.StaticRuntimePlusToolkit CudaOnlyStaticRuntimePlusToolkit) - # `isystem` behaves differently on windows with nvcc - add_cuda_test_macro(CudaOnly.ToolkitIsSystemInclude CudaOnlySystemInclude) endif() add_cuda_test_macro(CudaOnly.DeviceLTO CudaOnlyDeviceLTO) diff --git a/Tests/CudaOnly/ToolkitIsSystemInclude/CMakeLists.txt b/Tests/CudaOnly/ToolkitIsSystemInclude/CMakeLists.txt deleted file mode 100644 index bc347dd..0000000 --- a/Tests/CudaOnly/ToolkitIsSystemInclude/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 3.24) -project(ToolkitIsSystemInclude CUDA) - -# Verify that the nvrtc.h that is inside `CMAKE_CURRENT_SOURCE_DIR` is still -# the first include for `.cu` files. -add_executable(CudaOnlySystemInclude main.cu) -target_include_directories(CudaOnlySystemInclude SYSTEM PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include) diff --git a/Tests/CudaOnly/ToolkitIsSystemInclude/include/nvrtc.h b/Tests/CudaOnly/ToolkitIsSystemInclude/include/nvrtc.h deleted file mode 100644 index 5a015c4..0000000 --- a/Tests/CudaOnly/ToolkitIsSystemInclude/include/nvrtc.h +++ /dev/null @@ -1,5 +0,0 @@ -#define CMAKE_CUDA_TOOLKIT_IS_SYSTEM 1 - -int main() -{ -} diff --git a/Tests/CudaOnly/ToolkitIsSystemInclude/main.cu b/Tests/CudaOnly/ToolkitIsSystemInclude/main.cu deleted file mode 100644 index 6cff8a1..0000000 --- a/Tests/CudaOnly/ToolkitIsSystemInclude/main.cu +++ /dev/null @@ -1,4 +0,0 @@ -#include "nvrtc.h" -#ifndef CMAKE_CUDA_TOOLKIT_IS_SYSTEM -# error "Failed to specify the CUDA Toolkit includes as system" -#endif -- cgit v0.12