Merge topic 'skip-find-tbb-if-loaded'

c30c35571 Revert "Disable loading the TBBConfig.cmake file"
dd3fc9781 cmake: skip find_package(TBB) if already loaded

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Kenneth Moreland <morelandkd@ornl.gov>
Merge-request: !2835
This commit is contained in:
Vicente Bolea 2022-08-04 21:33:40 +00:00 committed by Kitware Robot
commit 7c25d8f0f4
2 changed files with 28 additions and 27 deletions

@ -70,32 +70,29 @@
# Use TBBConfig.cmake if possible.
# Disabling this as it running the TBBConfig.cmake on dragnipur is
# causing a CMake error. I don't know if this is an install problem
# or an issue with version 2018.0.
# 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 ()
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

@ -42,7 +42,11 @@ function(vtkm_extract_real_library library real_library)
endfunction()
if(VTKm_ENABLE_TBB AND NOT TARGET vtkm::tbb)
find_package(TBB REQUIRED)
# Skip find_package(TBB) if we already have it
if (NOT TARGET TBB::tbb)
find_package(TBB REQUIRED)
endif()
add_library(vtkmTBB INTERFACE)
add_library(vtkm::tbb ALIAS vtkmTBB)
target_link_libraries(vtkmTBB INTERFACE TBB::tbb)