From a573336f8da453fcb19803d3615d0ba80167f894 Mon Sep 17 00:00:00 2001
From: Martin Bauer <martin.bauer@fau.de>
Date: Wed, 2 Aug 2017 10:08:33 +0200
Subject: [PATCH] CMake CUDA: workaround for nvcc's not using system includes

- nvcc also printed warnings in system libs like boost
---
 CMakeLists.txt | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index fb4ce8c0f..fbd21e22c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1068,6 +1068,16 @@ if ( WALBERLA_BUILD_WITH_CUDA )
         list ( APPEND SERVICE_LIBS ${CUDA_LIBRARIES} )
 
         list( APPEND CUDA_NVCC_FLAGS "-Wno-deprecated-gpu-targets")
+
+        # FindCUDA does not respect system includes i.e. there are also warnings for boost etc reported (as of cmake 3.5.1)
+        # if all includes are added to the flags manually as sytem includes they occur double on the command line
+        # but the compiler seems to note the "isystem" not the "-I"
+        # it is also not possible to get all system include directories - so as a workaround we at least add boost here
+        # as system include
+        foreach( boostInclude ${Boost_INCLUDE_DIRS} )
+            list( APPEND CUDA_NVCC_FLAGS "-isystem ${boostInclude}" )
+        endforeach()
+
         if ( NOT "${CUDA_NVCC_FLAGS}" MATCHES "-std=" )
             list ( APPEND CUDA_NVCC_FLAGS "-std=c++11" )
         endif ()
-- 
GitLab