-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
95 lines (84 loc) · 2.64 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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
cmake_minimum_required(VERSION 3.17)
project(boost)
include(cmake/pkg.cmake)
add_library(boost INTERFACE)
target_include_directories(boost SYSTEM INTERFACE .)
target_compile_definitions(boost INTERFACE
BOOST_BIND_GLOBAL_PLACEHOLDERS=1
BOOST_ALL_NO_LIB=1
)
if (WIN32)
target_compile_definitions(boost INTERFACE
BOOST_THREAD_BUILD_LIB=1
BOOST_THREAD_WIN32=1
WIN32_LEAN_AND_MEAN=1
)
endif()
# these libraries don't compile with this generic config
set(disabled-libs
context
fiber
graph_parallel
locale
log
math
metaparse
mpi
mpl
python
spirit
stacktrace
)
set(manual-libs
atomic
filesystem
)
file(GLOB libs RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}/libs ${CMAKE_CURRENT_SOURCE_DIR}/libs/*)
list(REMOVE_ITEM libs ".DS_Store")
list(REMOVE_ITEM libs ${disabled-libs})
list(REMOVE_ITEM libs ${manual-libs})
foreach(lib ${libs})
file(GLOB_RECURSE boost-${lib}-files ${CMAKE_CURRENT_SOURCE_DIR}/libs/${lib}/src/**.cpp)
if (WIN32)
file(GLOB unwanted-system-specific
${CMAKE_CURRENT_SOURCE_DIR}/libs/${lib}/src/pthread/*.cpp
${CMAKE_CURRENT_SOURCE_DIR}/libs/${lib}/src/posix/*.cpp
)
else()
file(GLOB unwanted-system-specific
${CMAKE_CURRENT_SOURCE_DIR}/libs/${lib}/src/win32/*.cpp
${CMAKE_CURRENT_SOURCE_DIR}/libs/${lib}/src/windows/*.cpp
)
endif()
file(GLOB unwanted
${CMAKE_CURRENT_SOURCE_DIR}/libs/${lib}/*/bzip2.cpp
${CMAKE_CURRENT_SOURCE_DIR}/libs/${lib}/*/lzma.cpp
${CMAKE_CURRENT_SOURCE_DIR}/libs/${lib}/*/zstd.cpp
${CMAKE_CURRENT_SOURCE_DIR}/libs/${lib}/src/gregorian/greg_weekday.cpp
${CMAKE_CURRENT_SOURCE_DIR}/libs/${lib}/src/gregorian/date_generators.cpp
)
list(LENGTH unwanted unwanted-length)
if (unwanted-length)
list(REMOVE_ITEM boost-${lib}-files ${unwanted})
endif()
if (unwanted-system-specific)
list(REMOVE_ITEM boost-${lib}-files ${unwanted-system-specific})
endif()
add_library(boost-${lib} ${boost-${lib}-files})
target_link_libraries(boost-${lib} boost)
target_compile_features(boost-${lib} PUBLIC cxx_std_17)
if (MSVC)
target_compile_options(boost-${lib} PRIVATE /w)
else()
target_compile_options(boost-${lib} PRIVATE -w)
endif()
endforeach()
foreach(lib ${manual-libs})
add_subdirectory(libs/${lib})
endforeach()
target_link_libraries(boost-iostreams zlibstatic)
target_compile_features(boost-url PUBLIC cxx_constexpr)
target_compile_features(boost-json PUBLIC cxx_constexpr)
if (MSVC)
target_compile_definitions(boost INTERFACE BOOST_ASIO_HAS_ALIGNOF=1)
endif()