diff --git a/Installation/cmake/modules/CGAL_Common.cmake b/Installation/cmake/modules/CGAL_Common.cmake index 9ade617f663..59f8190136d 100644 --- a/Installation/cmake/modules/CGAL_Common.cmake +++ b/Installation/cmake/modules/CGAL_Common.cmake @@ -61,5 +61,6 @@ if( NOT CGAL_COMMON_FILE_INCLUDED ) # set use-file for Eigen3 (needed to have default solvers) set(EIGEN3_USE_FILE "UseEigen3") - + set(TBB_USE_FILE "UseTBB") + include(${CMAKE_CURRENT_LIST_DIR}/CGAL_target_use_TBB.cmake) endif() diff --git a/Installation/cmake/modules/CGAL_target_use_TBB.cmake b/Installation/cmake/modules/CGAL_target_use_TBB.cmake index 23e9acd72f1..631ece6a286 100644 --- a/Installation/cmake/modules/CGAL_target_use_TBB.cmake +++ b/Installation/cmake/modules/CGAL_target_use_TBB.cmake @@ -4,7 +4,9 @@ endif() set(CGAL_target_use_TBB_included TRUE) function(CGAL_target_use_TBB target) - target_include_directories ( ${target} SYSTEM PUBLIC ${TBB_INCLUDE_DIRS} ) - target_link_libraries( ${target} PUBLIC ${TBB_LIBRARIES} ) + if(NOT TARGET Threads::Threads) + find_package(Threads REQUIRED) + endif() + target_link_libraries( ${target} PUBLIC TBB::tbb TBB::tbbmalloc Threads::Threads) target_compile_options( ${target} PUBLIC -DNOMINMAX -DCGAL_LINKED_WITH_TBB ) endfunction() diff --git a/Installation/cmake/modules/FindTBB.cmake b/Installation/cmake/modules/FindTBB.cmake index 5e7dc208df8..b1a3d884c65 100644 --- a/Installation/cmake/modules/FindTBB.cmake +++ b/Installation/cmake/modules/FindTBB.cmake @@ -419,6 +419,3 @@ if(NOT TBB_VERSION) TBB_COMPATIBLE_INTERFACE_VERSION "${TBB_VERSION_CONTENTS}") endif() - -set(TBB_USE_FILE "UseTBB") -include(${CMAKE_CURRENT_LIST_DIR}/CGAL_target_use_TBB.cmake) diff --git a/Installation/lib/cmake/CGAL/CGALConfig.cmake b/Installation/lib/cmake/CGAL/CGALConfig.cmake index c2b0aed549d..630117e24ad 100644 --- a/Installation/lib/cmake/CGAL/CGALConfig.cmake +++ b/Installation/lib/cmake/CGAL/CGALConfig.cmake @@ -140,6 +140,8 @@ include(${CGAL_MODULES_DIR}/CGAL_TweakFindBoost.cmake) cgal_setup_module_path() set(CGAL_USE_FILE ${CGAL_MODULES_DIR}/UseCGAL.cmake) +set(TBB_USE_FILE "UseTBB") +include(${CMAKE_CURRENT_LIST_DIR}/CGAL_target_use_TBB.cmake) include("${CGAL_MODULES_DIR}/CGAL_parse_version_h.cmake") cgal_parse_version_h( "${CGAL_INSTALLATION_PACKAGE_DIR}/include/CGAL/version.h"