CMakeLists.txt 1.24 KB
Newer Older
Pascal Palenda's avatar
Pascal Palenda committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
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})

Pascal Palenda's avatar
Pascal Palenda committed
15
16
17
18
if (TBB_DIR)
	unset (TBB_DIR CACHE)
endif ()

Pascal Palenda's avatar
Pascal Palenda committed
19
20
21
22
CPMAddPackage (
	NAME tbb
	GITHUB_REPOSITORY oneapi-src/oneTBB
	GIT_TAG v2021.3.0
Pascal Palenda's avatar
Pascal Palenda committed
23
	OPTIONS "TBB_TEST OFF" "TBBMALLOC_BUILD OFF" "TBB_FIND_PACKAGE OFF"
Pascal Palenda's avatar
Pascal Palenda committed
24
25
26
27
28
29
30
)

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

	if (WIN32)
		set_target_properties (
31
			tbb tbbmalloc tbbmalloc_proxy PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}
Pascal Palenda's avatar
Pascal Palenda committed
32
33
		)
		set_target_properties (
34
			tbb tbbmalloc tbbmalloc_proxy PROPERTIES ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}
Pascal Palenda's avatar
Pascal Palenda committed
35
36
		)
		set_target_properties (
37
			tbb tbbmalloc tbbmalloc_proxy PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}
Pascal Palenda's avatar
Pascal Palenda committed
38
39
40
		)
	endif ()
endif ()