From 66552962aea6e8b51f1d1ce29cbf62991ead9957 Mon Sep 17 00:00:00 2001 From: Eduard Valeyev Date: Mon, 11 Dec 2023 09:06:11 -0500 Subject: [PATCH] try to fix TBB detection issues described in https://github.com/m-a-d-n-e-s-s/madness/issues/510 --- cmake/modules/FindTBB.cmake | 51 ++++++++++++++++++------------------- 1 file changed, 25 insertions(+), 26 deletions(-) diff --git a/cmake/modules/FindTBB.cmake b/cmake/modules/FindTBB.cmake index b832016b4b6..2199921f0e9 100644 --- a/cmake/modules/FindTBB.cmake +++ b/cmake/modules/FindTBB.cmake @@ -73,32 +73,6 @@ # FindTBB helper functions and macros # -# Use TBBConfig.cmake if possible. - -set(_tbb_find_quiet) -if (TBB_FIND_QUIETLY) - set(_tbb_find_quiet QUIET) -endif () -set(_tbb_find_components) -set(_tbb_find_optional_components) -foreach (_tbb_find_component IN LISTS TBB_FIND_COMPONENTS) - if (TBB_FIND_REQUIRED_${_tbb_find_component}) - list(APPEND _tbb_find_components "${_tbb_find_component}") - else () - list(APPEND _tbb_find_optional_components "${_tbb_find_component}") - endif () -endforeach () -unset(_tbb_find_component) -find_package(TBB CONFIG ${_tbb_find_quiet} - COMPONENTS ${_tbb_find_components} - OPTIONAL_COMPONENTS ${_tbb_find_optional_components}) -unset(_tbb_find_quiet) -unset(_tbb_find_components) -unset(_tbb_find_optional_components) -if (TBB_FOUND) - return () -endif () - #==================================================== # Fix the library path in case it is a linker script #==================================================== @@ -238,6 +212,31 @@ set(TBB_PREFIX_PATH ${TBBROOT} ${ENV_TBBROOT}) set(TBB_INC_SEARCH_PATH "") set(TBB_LIB_SEARCH_PATH "") +# Use TBBConfig.cmake if possible. +set(_tbb_find_quiet) +if (TBB_FIND_QUIETLY) + set(_tbb_find_quiet QUIET) +endif () +set(_tbb_find_components) +set(_tbb_find_optional_components) +foreach (_tbb_find_component IN LISTS TBB_FIND_COMPONENTS) + if (TBB_FIND_REQUIRED_${_tbb_find_component}) + list(APPEND _tbb_find_components "${_tbb_find_component}") + else () + list(APPEND _tbb_find_optional_components "${_tbb_find_component}") + endif () +endforeach () +unset(_tbb_find_component) +find_package(TBB CONFIG ${_tbb_find_quiet} + COMPONENTS ${_tbb_find_components} + OPTIONAL_COMPONENTS ${_tbb_find_optional_components} + HINTS ${TBB_PREFIX_PATH}) +unset(_tbb_find_quiet) +unset(_tbb_find_components) +unset(_tbb_find_optional_components) +if (TBB_FOUND) + return () +endif () # If user built from sources set(TBB_BUILD_PREFIX $ENV{TBB_BUILD_PREFIX})