CMakeLists.txt 1.15 KB
Newer Older
Pascal Palenda's avatar
Pascal Palenda committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
set (CPM_DOWNLOAD_VERSION 0.32.2)
set (CPM_DOWNLOAD_LOCATION "${CMAKE_BINARY_DIR}/cmake/CPM_${CPM_DOWNLOAD_VERSION}.cmake")

if (NOT (EXISTS ${CPM_DOWNLOAD_LOCATION}))
	message (STATUS "Downloading CPM.cmake")
	file (DOWNLOAD https://github.com/TheLartians/CPM.cmake/releases/download/v${CPM_DOWNLOAD_VERSION}/CPM.cmake
		  ${CPM_DOWNLOAD_LOCATION}
	)
else (NOT (EXISTS ${CPM_DOWNLOAD_LOCATION}))
	message ("CPM already exists, do not need to download")
endif (NOT (EXISTS ${CPM_DOWNLOAD_LOCATION}))

include (${CPM_DOWNLOAD_LOCATION})

CPMAddPackage (
	NAME tbb
	GITHUB_REPOSITORY oneapi-src/oneTBB
	GIT_TAG v2021.3.0
	OPTIONS "TBB_TEST OFF" "TBBMALLOC_BUILD OFF"
)

if (tbb_ADDED)
	set_target_properties (tbb tbbmalloc tbbmalloc_proxy PROPERTIES FOLDER "external_libs")

	if (WIN32)
		set_target_properties (
			tbb tbbmalloc tbbmalloc_proxy PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
		)
		set_target_properties (
			tbb tbbmalloc tbbmalloc_proxy PROPERTIES ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib
		)
		set_target_properties (
			tbb tbbmalloc tbbmalloc_proxy PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib
		)
	endif ()
endif ()