From 2ee1224917f2d4307e3ea478cc3dbf5da0777ac2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Atgeirr=20Fl=C3=B8=20Rasmussen?= Date: Mon, 21 Nov 2016 11:08:38 +0100 Subject: [PATCH] Make use of system includes for cross-module optional. --- cmake/Modules/OpmCompile.cmake | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/cmake/Modules/OpmCompile.cmake b/cmake/Modules/OpmCompile.cmake index e6c9c01a9..10fa2d789 100644 --- a/cmake/Modules/OpmCompile.cmake +++ b/cmake/Modules/OpmCompile.cmake @@ -13,13 +13,19 @@ macro (opm_compile opm) # all public header files are together with the source. prepend our own # source path to the one of the dependencies so that our version of any # ambigious paths are used. - # set (${opm}_INCLUDE_DIR "${PROJECT_SOURCE_DIR}") - # set (${opm}_INCLUDE_DIRS ${${opm}_INCLUDE_DIR} ${${opm}_INCLUDE_DIRS}) + + option(SILENCE_CROSSMODULE_WARNINGS "Disable warnings from cross-module includes" OFF) + if (SILENCE_CROSSMODULE_WARNINGS) + include_directories("${PROJECT_SOURCE_DIR}") + include_directories (SYSTEM ${${opm}_INCLUDE_DIRS}) + else() + set (${opm}_INCLUDE_DIR "${PROJECT_SOURCE_DIR}") + set (${opm}_INCLUDE_DIRS ${${opm}_INCLUDE_DIR} ${${opm}_INCLUDE_DIRS}) + include_directories (${${opm}_INCLUDE_DIRS}) + endif() + # create this library, if there are any compilation units - # include_directories (${${opm}_INCLUDE_DIRS}) - include_directories("${PROJECT_SOURCE_DIR}") - include_directories (SYSTEM ${${opm}_INCLUDE_DIRS}) link_directories (${${opm}_LIBRARY_DIRS}) add_definitions (${${opm}_DEFINITIONS}) set (${opm}_VERSION "${${opm}_VERSION_MAJOR}.${${opm}_VERSION_MINOR}")