From: Fabio Rossi <rossi.f@inwind.it>
See-Also: https://tracker.dev.opencascade.org/view.php?id=33612
Fix tbb detection

--- ./adm/cmake/tbb.cmake	2022-11-11 23:19:44.000000000 +0100
+++ ./adm/cmake/tbb.cmake.new	2024-02-24 18:59:32.267165878 +0100
@@ -56,13 +56,17 @@
       list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_TBB_INCLUDE_DIR)
     endif()
 
+    # Get installed configuration of tbb
+    get_target_property (TARGET_TBB_IMPORT_CONFS TBB::tbb IMPORTED_CONFIGURATIONS)
+    list (GET TARGET_TBB_IMPORT_CONFS 0 CHOSEN_IMPORT_CONF)
+
     separate_arguments (CSF_TBB)
     foreach (LIB IN LISTS CSF_TBB)
       string(TOLOWER "${LIB}" LIB_LOWER)
       string(TOUPPER "${LIB}" LIB_UPPER)
 
       # Achive *.lib files and directory containing it.
-      get_target_property (TBB_LIB_FILE "TBB::${LIB_LOWER}" IMPORTED_IMPLIB_RELEASE)
+      get_target_property (TBB_LIB_FILE "TBB::${LIB_LOWER}" IMPORTED_IMPLIB_${CHOSEN_IMPORT_CONF})
       # Reserve cache variable for *.lib.
       if (NOT DEFINED 3RDPARTY_${LIB_UPPER}_LIBRARY)
         set (3RDPARTY_${LIB_UPPER}_LIBRARY "" CACHE FILEPATH "${LIB_UPPER} library (*.lib)")
@@ -89,7 +93,7 @@
       endif()
 
       # Achive *.dll files and directory containing it.
-      get_target_property (TBB_DLL_FILE "TBB::${LIB_LOWER}" IMPORTED_LOCATION_RELEASE)
+      get_target_property (TBB_DLL_FILE "TBB::${LIB_LOWER}" IMPORTED_LOCATION_${CHOSEN_IMPORT_CONF})
       # Reserve cache variable for *.dll.
       if (NOT DEFINED 3RDPARTY_${LIB_UPPER}_DLL)
         set (3RDPARTY_${LIB_UPPER}_DLL "" CACHE FILEPATH "${LIB_UPPER} library (*.dll)")
@@ -185,13 +189,17 @@
     list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_TBB_INCLUDE_DIR)
   endif()
 
+  # Get installed configuration of tbb
+  get_target_property (TARGET_TBB_IMPORT_CONFS TBB::tbb IMPORTED_CONFIGURATIONS)
+  list (GET TARGET_TBB_IMPORT_CONFS 0 CHOSEN_IMPORT_CONF)
+
   separate_arguments (CSF_TBB)
   foreach (LIB IN LISTS CSF_TBB)
     string(TOLOWER "${LIB}" LIB_LOWER)
     string(TOUPPER "${LIB}" LIB_UPPER)
 
     # Achive *.so files and directory containing it.
-    get_target_property (TBB_SO_FILE "TBB::${LIB_LOWER}" IMPORTED_LOCATION_RELEASE)
+    get_target_property (TBB_SO_FILE "TBB::${LIB_LOWER}" IMPORTED_LOCATION_${CHOSEN_IMPORT_CONF})
     # Reserve cache variable for *.so.
     if (NOT DEFINED 3RDPARTY_${LIB_UPPER}_LIBRARY)
       set (3RDPARTY_${LIB_UPPER}_LIBRARY "" CACHE FILEPATH "${LIB_UPPER} library (*.so)")
