-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
49 lines (40 loc) · 1.58 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
cmake_minimum_required(VERSION 3.5)
project(asio_coro_extensions)
option(WITH_TESTS "Build tests" ON)
option(WITH_EXAMPLES "Build examples" ON)
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
set(CMAKE_CXX_STANDARD 20)
find_package(Boost REQUIRED system thread)
set(HEADERS
src/asio_coro/asio_coro.hpp
src/asio_coro/async_accept.hpp
src/asio_coro/async_connect.hpp
src/asio_coro/async_mutex.hpp
src/asio_coro/async_read.hpp
src/asio_coro/async_wait_signal.hpp
src/asio_coro/async_wait.hpp
src/asio_coro/async_write.hpp
src/asio_coro/boost_future.hpp
src/asio_coro/dispatch.hpp
src/asio_coro/post.hpp
src/asio_coro/task.hpp
src/asio_coro/detail/coroutine_holder.hpp
src/asio_coro/detail/coroutine.hpp
src/asio_coro/detail/task.hpp)
add_library(asio_coro_extensions ${HEADERS})
target_link_libraries(asio_coro_extensions PUBLIC Boost::thread Boost::system)
set_target_properties(asio_coro_extensions PROPERTIES LINKER_LANGUAGE CXX)
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
target_compile_options(asio_coro_extensions PUBLIC -fcoroutines)
elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
target_compile_options(asio_coro_extensions PUBLIC -fcoroutines-ts)
endif()
target_include_directories(asio_coro_extensions PUBLIC src)
target_compile_definitions(asio_coro_extensions PUBLIC BOOST_ASIO_DISABLE_CONCEPTS)
if(${WITH_TESTS})
add_subdirectory(tests)
endif()
if(${WITH_EXAMPLES})
find_package(FMT REQUIRED)
add_subdirectory(examples)
endif()