Skip to content

Commit b3e6b10

Browse files
authored
Avoid repeated TBB discovery (#32936)
### Details: The problem is that TBB detection logic in `src/cmake/ov_parallel.cmake` is being invoked multiple times during configuration if `-DTHREADING=TBB` or `-DTHREADING=TBB_AUTO` are used. It works correctly only for `TBB_ADAPTIVE` case. This patch fixes operator precedence in the check to avoid re-discovery of TBB on each `ov_find_package_tbb()` and as a result `ov_set_threading_interface_for()` CMake functions invocations ### Tickets: - N/A
1 parent 275f743 commit b3e6b10

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/cmake/ov_parallel.cmake

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ function(_ov_get_tbb_location tbb_target _tbb_lib_location_var)
7676
endfunction()
7777

7878
macro(ov_find_package_tbb)
79-
if(THREADING STREQUAL "TBB" OR THREADING STREQUAL "TBB_AUTO" OR THREADING STREQUAL "TBB_ADAPTIVE" AND NOT TBB_FOUND)
79+
if((THREADING STREQUAL "TBB" OR THREADING STREQUAL "TBB_AUTO" OR THREADING STREQUAL "TBB_ADAPTIVE") AND NOT TBB_FOUND)
8080
# conan generates TBBConfig.cmake files, which follows cmake's
8181
# SameMajorVersion scheme, while TBB itself follows AnyNewerVersion one
8282
# see https://cmake.org/cmake/help/latest/module/CMakePackageConfigHelpers.html#generating-a-package-version-file
@@ -337,7 +337,7 @@ macro(ov_find_package_openmp)
337337
endmacro()
338338

339339
function(ov_set_threading_interface_for TARGET_NAME)
340-
if(THREADING STREQUAL "TBB" OR THREADING STREQUAL "TBB_AUTO" OR THREADING STREQUAL "TBB_ADAPTIVE" AND NOT TBB_FOUND)
340+
if((THREADING STREQUAL "TBB" OR THREADING STREQUAL "TBB_AUTO" OR THREADING STREQUAL "TBB_ADAPTIVE") AND NOT TBB_FOUND)
341341
# find TBB
342342
ov_find_package_tbb()
343343

0 commit comments

Comments
 (0)