From 9397b1aa88ce291eb8d1cc203689728779cc319e Mon Sep 17 00:00:00 2001 From: Marko Petric <marko.petric@cern.ch> Date: Wed, 2 Nov 2016 21:42:30 +0100 Subject: [PATCH] Addopt A.Sailer function as general function to set properly SYSTEM --- cmake/DD4hepBuild.cmake | 31 ++++++++++++++++++++++--------- 1 file changed, 22 insertions(+), 9 deletions(-) diff --git a/cmake/DD4hepBuild.cmake b/cmake/DD4hepBuild.cmake index 57fd1b3f7..ef3a98c8c 100644 --- a/cmake/DD4hepBuild.cmake +++ b/cmake/DD4hepBuild.cmake @@ -71,6 +71,26 @@ function ( dd4hep_debug msg ) endif() endfunction( dd4hep_debug ) +#--------------------------------------------------------------------------------------------------- +# dd4hep_include_directories +# +# Same as include_directories but treat all external packages as SYSTEM -> no warnings +# +# \author A.Sailer +# \version 1.0 +# +#--------------------------------------------------------------------------------------------------- +function ( dd4hep_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() +endfunction( dd4hep_include_directories ) + #--------------------------------------------------------------------------------------------------- # dd4hep_print # @@ -938,14 +958,7 @@ function( dd4hep_add_library binary building ) dd4hep_make_unique_list ( sources VALUES ${sources} ) dd4hep_debug( "${tag} ${sources}") # - 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() + dd4hep_include_directories( "${pkg_incs}" ) add_definitions ( ${pkg_defs} ) # add_library ( ${binary} SHARED ${sources} ) @@ -1139,7 +1152,7 @@ function ( dd4hep_add_executable binary ) dd4hep_make_unique_list ( sources VALUES ${sources} ) # dd4hep_debug ( "${tag} Libs:${libs}" ) - include_directories( ${incs} ) + dd4hep_include_directories( "${incs}" ) add_executable( ${binary} ${sources} ) target_link_libraries( ${binary} ${libs} ) # -- GitLab