forked from Orphis/boost-cmake
-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
71 lines (59 loc) · 2.51 KB
/
CMakeLists.txt
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
cmake_minimum_required(VERSION 3.0.0)
project(Boost-CMake)
option(BOOST_DOWNLOAD_TO_BINARY_DIR "Prefer downloading Boost to the binary directory instead of source directory" OFF)
set(BOOST_URL "https://archives.boost.io/release/1.85.0/source/boost_1_85_0.tar.bz2" CACHE STRING "Boost download URL")
set(BOOST_URL_SHA256 "7009fe1faa1697476bdc7027703a2badb84e849b7b0baad5086b087b971f8617" CACHE STRING "Boost download URL SHA256 checksum")
set(BOOST_ARCHIVE_DIRECTORY "" CACHE DIRECTORY "Use the specified local directory to search for boost archives instead of downloading them" )
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules)
include(DownloadBoost)
message(STATUS "Boost found: ${BOOST_VERSION} ${BOOST_SOURCE}")
include(StandaloneBuild)
include(PlatformDetect)
include(AddBoostLib)
include(AddBoostTest)
set_property(GLOBAL PROPERTY USE_FOLDERS TRUE)
if(USE_ANDROID)
# CMake 3.7.1 doesn't define the target triple for the ASM language,
# resulting in all files compiled for the host architecture
set(CMAKE_ASM_COMPILER_TARGET "${CMAKE_CXX_COMPILER_TARGET}")
endif()
set(BOOST_LIBS_REQUIRED
# Header only libs
header
)
if(XACC_BUILD_ANNEALING)
set(BOOST_LIBS_OPTIONAL
graph
regex
system
serialization
)
else()
set(BOOST_LIBS_OPTIONAL
graph
regex
serialization
)
endif()
foreach(lib ${BOOST_LIBS_REQUIRED})
include("libs/${lib}.cmake")
endforeach()
foreach(lib ${BOOST_LIBS_OPTIONAL})
# In case only a subset of modules is available (eg. after using bcp)
if(EXISTS "${BOOST_SOURCE}/libs/${lib}")
include("libs/${lib}.cmake")
endif()
endforeach()
# TODO: Move those to option() calls in the right file
if(NOT BOOST_STANDALONE)
# Compilation options required by all platforms
set_property(TARGET Boost::boost APPEND PROPERTY INTERFACE_COMPILE_DEFINITIONS $<$<CONFIG:Release>:BOOST_DISABLE_ASSERT>)
set_property(TARGET Boost::boost APPEND PROPERTY INTERFACE_COMPILE_DEFINITIONS BOOST_SYSTEM_NO_DEPRECATED)
set_property(TARGET Boost::boost APPEND PROPERTY INTERFACE_COMPILE_DEFINITIONS BOOST_THREAD_VERSION=4)
set_property(TARGET Boost::boost APPEND PROPERTY INTERFACE_COMPILE_DEFINITIONS BOOST_THREAD_USES_CHRONO)
set_property(TARGET Boost::boost APPEND PROPERTY INTERFACE_COMPILE_DEFINITIONS BOOST_THREAD_PROVIDES_EXECUTORS)
endif()
if(USE_ANDROID)
# Android doesn't support thread local storage through compiler intrinsics
set_property(TARGET Boost::boost APPEND PROPERTY INTERFACE_COMPILE_DEFINITIONS BOOST_ASIO_DISABLE_THREAD_KEYWORD_EXTENSION)
endif()