From 62dbbd7f4c6eac091b3c9babd3323527783c76e3 Mon Sep 17 00:00:00 2001
From: Andre Sailer <andre.philippe.sailer@cern.ch>
Date: Thu, 27 Oct 2016 13:02:25 +0200
Subject: [PATCH] CMake: Check if include_directories are inside dd4hep or not,
 if not set SYSTEM to ignore warnings

---
 cmake/DD4hepBuild.cmake | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/cmake/DD4hepBuild.cmake b/cmake/DD4hepBuild.cmake
index 4f24dc079..57fd1b3f7 100644
--- a/cmake/DD4hepBuild.cmake
+++ b/cmake/DD4hepBuild.cmake
@@ -938,7 +938,14 @@ function( dd4hep_add_library binary building )
         dd4hep_make_unique_list ( sources  VALUES ${sources} )
         dd4hep_debug( "${tag} ${sources}")
         #
-        include_directories ( ${pkg_incs} )
+        FOREACH( INCDIR ${pkg_incs} )
+          string(FIND "${INCDIR}" "${CMAKE_SOURCE_DIR}" out)
+          IF("${out}" EQUAL 0)
+            INCLUDE_DIRECTORIES( ${INCDIR} )
+          ELSE()
+            INCLUDE_DIRECTORIES( SYSTEM ${INCDIR} )
+          ENDIF()
+        ENDFOREACH()
         add_definitions ( ${pkg_defs} )
         #
         add_library ( ${binary} SHARED ${sources} )
-- 
GitLab