When 'Wall' flag is set, FindCUDA.cmake generates literally thousands of warnings from NVIDIA¹s header files (primarily -Wunused-function warnings). This patch (below email signature) removes those warnings by using the CMAKE_INCLUDE_SYSTEM_FLAG_C flag to treat NVIDIA’s include files as system headers. -- Michael Tanner
From 725d0d7d078bf6a150560a5aa4e1d11fe6691ec9 Mon Sep 17 00:00:00 2001 From: Michael Tanner <[email protected]> Date: Sun, 29 Mar 2015 00:55:34 +0000 Subject: [PATCH] Fixes FindCUDA.cmake to prevent system warnings Previously, the NVIDIA header/implementaiton files would generate literally thousands of warnings to comopile even the simpleste of CUDA projects with "-Wall". --- Modules/FindCUDA.cmake | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Modules/FindCUDA.cmake b/Modules/FindCUDA.cmake index 81e1cad..c79ff35 100644 --- a/Modules/FindCUDA.cmake +++ b/Modules/FindCUDA.cmake @@ -1097,7 +1097,8 @@ macro(CUDA_WRAP_SRCS cuda_target format generated_files) endif() # Initialize our list of includes with the user ones followed by the CUDA system ones. - set(CUDA_NVCC_INCLUDE_ARGS ${CUDA_NVCC_INCLUDE_ARGS_USER} "-I${CUDA_INCLUDE_DIRS}") + string(STRIP ${CMAKE_INCLUDE_SYSTEM_FLAG_C} CMAKE_INCLUDE_SYSTEM_FLAG_C_STRIPPED) + set(CUDA_NVCC_INCLUDE_ARGS ${CUDA_NVCC_INCLUDE_ARGS_USER} ${CMAKE_INCLUDE_SYSTEM_FLAG_C_STRIPPED} ${CUDA_INCLUDE_DIRS}) # Get the include directories for this directory and use them for our nvcc command. # Remove duplicate entries which may be present since include_directories # in CMake >= 2.8.8 does not remove them. -- 2.1.0 -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake-developers
