forked from boostorg/thread
-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
105 lines (80 loc) · 2.38 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
96
97
98
99
100
101
102
103
104
# Generated by `boostdep --cmake thread`
# Copyright 2020 Peter Dimov
# Distributed under the Boost Software License, Version 1.0.
# https://www.boost.org/LICENSE_1_0.txt
cmake_minimum_required(VERSION 3.5...3.16)
project(boost_thread VERSION "${BOOST_SUPERPROJECT_VERSION}" LANGUAGES CXX)
set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)
set(_default_threadapi pthread)
if(WIN32 AND NOT CMAKE_CXX_PLATFORM_ID MATCHES "Cygwin")
set(_default_threadapi win32)
endif()
set(BOOST_THREAD_THREADAPI ${_default_threadapi} CACHE STRING "Boost.Thread threading API (pthread or win32)")
set_property(CACHE BOOST_THREAD_THREADAPI PROPERTY STRINGS pthread win32)
unset(_default_threadapi)
message(STATUS "Boost.Thread: threading API is ${BOOST_THREAD_THREADAPI}")
if(BOOST_THREAD_THREADAPI STREQUAL win32)
set(THREAD_SOURCES
src/win32/thread.cpp
src/win32/tss_dll.cpp
src/win32/tss_pe.cpp
src/win32/thread_primitives.cpp
src/future.cpp
)
else()
set(THREAD_SOURCES
src/pthread/thread.cpp
src/pthread/once.cpp
src/future.cpp
)
endif()
add_library(boost_thread ${THREAD_SOURCES})
add_library(Boost::thread ALIAS boost_thread)
target_include_directories(boost_thread PUBLIC include)
target_link_libraries(boost_thread
PUBLIC
Boost::assert
Boost::atomic
Boost::bind
Boost::chrono
Boost::concept_check
Boost::config
Boost::container
Boost::container_hash
Boost::core
Boost::date_time
Boost::exception
Boost::function
Boost::intrusive
Boost::io
Boost::iterator
Boost::move
Boost::optional
Boost::predef
Boost::preprocessor
Boost::smart_ptr
Boost::static_assert
Boost::system
Boost::throw_exception
Boost::tuple
Boost::type_traits
Boost::utility
Boost::winapi
Threads::Threads
PRIVATE
Boost::algorithm
Boost::lexical_cast
)
target_compile_definitions(boost_thread
PUBLIC BOOST_THREAD_NO_LIB
PRIVATE BOOST_THREAD_SOURCE
)
if(BUILD_SHARED_LIBS)
target_compile_definitions(boost_thread PUBLIC BOOST_THREAD_DYN_LINK INTERFACE BOOST_THREAD_USE_DLL PRIVATE BOOST_THREAD_BUILD_DLL)
else()
target_compile_definitions(boost_thread PUBLIC BOOST_THREAD_STATIC_LINK INTERFACE BOOST_THREAD_USE_LIB PRIVATE BOOST_THREAD_BUILD_LIB)
endif()
if(BUILD_TESTING AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/test/CMakeLists.txt")
add_subdirectory(test)
endif()