1# - Find TBB
2# Find the Thread Building Blocks library and includes
3#
4# TBB_INCLUDE_DIRS - where to find tbb.h, etc.
5# TBB_LIBRARIES - List of libraries when using TBB.
6# TBB_FOUND - True if TBB found.
7
8if(NOT DEFINED TBB_ROOT_DIR)
9  set(TBB_ROOT_DIR "$ENV{TBBROOT}")
10endif()
11
12find_path(TBB_INCLUDE_DIRS
13  NAMES tbb/tbb.h
14  HINTS ${TBB_ROOT_DIR}/include)
15
16find_library(TBB_LIBRARIES
17  NAMES tbb
18  HINTS ${TBB_ROOT_DIR}/lib ENV LIBRARY_PATH)
19
20include(FindPackageHandleStandardArgs)
21find_package_handle_standard_args(TBB DEFAULT_MSG TBB_LIBRARIES TBB_INCLUDE_DIRS)
22
23mark_as_advanced(
24  TBB_LIBRARIES
25  TBB_INCLUDE_DIRS)
26
27if(TBB_FOUND AND NOT (TARGET TBB::TBB))
28  add_library (TBB::TBB UNKNOWN IMPORTED)
29  set_target_properties(TBB::TBB
30    PROPERTIES
31      IMPORTED_LOCATION ${TBB_LIBRARIES}
32      INTERFACE_INCLUDE_DIRECTORIES ${TBB_INCLUDE_DIRS})
33endif()
34