From: Matthias Maier <tamiko@43-1.org>
Date: Thu, 22 Jun 2023 01:41:53 +0000 (-0500)
Subject: CMake: avoid adding ${DEAL_II_BUNDLED_INCLUDE_DIRS} to bundled targets
X-Git-Tag: v9.5.0-rc1~52^2~3
X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7a20a8c98c34785c903755af923c16ad77bd8e78;p=dealii.git

CMake: avoid adding ${DEAL_II_BUNDLED_INCLUDE_DIRS} to bundled targets

These include files should only be added as system include directories
to dependend targets and not to the bundled targets themselves.

While this commit looks purely aesthetic, this commit actually works
around an obscure compiler bug with ICC 19 that otherwises errors out
with when trying to compile our bundled tbb library.
---

diff --git a/cmake/macros/macro_populate_target_properties.cmake b/cmake/macros/macro_populate_target_properties.cmake
index edd794a706..c85f4f0708 100644
--- a/cmake/macros/macro_populate_target_properties.cmake
+++ b/cmake/macros/macro_populate_target_properties.cmake
@@ -62,9 +62,17 @@ function(populate_target_properties _target _build)
     ${CMAKE_BINARY_DIR}/include
     ${CMAKE_SOURCE_DIR}/include
     )
-  target_include_directories(${_target} SYSTEM PRIVATE
-    ${DEAL_II_BUNDLED_INCLUDE_DIRS}
-    )
+
+  #
+  # Do not add bundled include directories to bundled_ targets. First of
+  # all this is unnecessary, secondly, this severly trips up ICC-19 that
+  # cannot handle the additional -isystem include properly...
+  #
+  if(NOT "${_target}" MATCHES "^bundled_")
+    target_include_directories(${_target} SYSTEM PRIVATE
+      ${DEAL_II_BUNDLED_INCLUDE_DIRS}
+      )
+  endif()
 
   # Interface includes: