AimRT/cmake/GetTBB.cmake

45 lines
812 B
CMake
Raw Normal View History

2024-09-23 16:01:31 +08:00
# Copyright (c) 2023, AgiBot Inc.
# All rights reserved.
include(FetchContent)
message(STATUS "get TBB ...")
set(tbb_DOWNLOAD_URL
"https://github.com/oneapi-src/oneTBB/archive/v2021.13.0.tar.gz"
CACHE STRING "")
if(tbb_LOCAL_SOURCE)
FetchContent_Declare(
tbb
SOURCE_DIR ${tbb_LOCAL_SOURCE}
OVERRIDE_FIND_PACKAGE)
else()
FetchContent_Declare(
tbb
URL ${tbb_DOWNLOAD_URL}
DOWNLOAD_EXTRACT_TIMESTAMP TRUE
OVERRIDE_FIND_PACKAGE)
endif()
# Wrap it in a function to restrict the scope of the variables
function(get_tbb)
FetchContent_GetProperties(tbb)
if(NOT tbb_POPULATED)
set(TBB_TEST OFF)
2024-09-23 16:01:31 +08:00
set(TBB_DIR "")
2024-09-23 16:01:31 +08:00
set(TBB_INSTALL ON)
2024-09-23 16:01:31 +08:00
set(TBB_STRICT OFF)
2024-09-23 16:01:31 +08:00
FetchContent_MakeAvailable(tbb)
endif()
endfunction()
get_tbb()
2024-09-23 16:01:31 +08:00
# import targets:
# TBB::tbb