From ce61237ba13474fa87532393ce33b63ff9ada36c Mon Sep 17 00:00:00 2001
From: Hadrien Grasland <grasland@lal.in2p3.fr>
Date: Thu, 6 Feb 2020 16:36:03 +0100
Subject: [PATCH] Use TBB_IMPORTED_TARGETS for TBB CMake configuration

Ever since TBB has started providing built-in CMake support in 2017 U7,
TBB_IMPORTED_TARGETS has been the only supported way to link to TBB
using CMake. In particular, the official TBB CMake files do not export
TBB_INCLUDE_DIR and TBB_LIBRARY variables.

See https://github.com/intel/tbb/blob/tbb_2020/cmake/README.rst for
more details about TBB's official CMake support.
---
 DDDigi/CMakeLists.txt | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/DDDigi/CMakeLists.txt b/DDDigi/CMakeLists.txt
index e6fb10960..88eb5c926 100644
--- a/DDDigi/CMakeLists.txt
+++ b/DDDigi/CMakeLists.txt
@@ -34,12 +34,10 @@ target_include_directories(DDDigi
 
 FIND_PACKAGE(TBB QUIET)
 if(TBB_FOUND)
-  dd4hep_print( "|++> TBB_INCLUDE_DIR -->  ${TBB_INCLUDE_DIR}")
-  dd4hep_print( "|++> TBB_LIBRARY     -->  ${TBB_LIBRARY}")
+  dd4hep_print( "|++> TBB_IMPORTED_TARGETS -->  ${TBB_IMPORTED_TARGETS}")
   dd4hep_print( "|++> TBB found. DDDigi will run multi threaded.")
   target_compile_definitions(DDDigi PUBLIC DD4HEP_USE_TBB)
-  target_link_libraries(DDDigi ${TBB_LIBRARY})
-  target_include_directories(DDDigi ${TBB_INCLUDE_DIRS})
+  target_link_libraries(DDDigi PUBLIC ${TBB_IMPORTED_TARGETS})
 else()
   dd4hep_print( "|++> TBB not found. DDDigi will only work single threaded.")
 endif()
-- 
GitLab