forked from MiSo1289/asiochan
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
35 lines (27 loc) · 1.06 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
cmake_minimum_required(VERSION 3.17)
set(ASIOCHAN_VERSION 0.4.3)
project(AsioChan VERSION "${ASIOCHAN_VERSION}")
include(CheckCXXCompilerFlag)
option(ASIOCHAN_USE_STANDALONE_ASIO "Use standalone ASIO instead of Boost.ASIO" OFF)
add_library(asiochan INTERFACE)
add_library(asiochan::asiochan ALIAS asiochan)
target_compile_features(asiochan INTERFACE cxx_std_20)
target_include_directories(asiochan INTERFACE include)
if (ASIOCHAN_USE_STANDALONE_ASIO)
target_compile_definitions(asiochan INTERFACE ASIOCHAN_USE_STANDALONE_ASIO)
endif()
# Building the tests and examples requires Conan packages
set(CONAN_BUILD_INFO_PATH "${CMAKE_CURRENT_BINARY_DIR}/conanbuildinfo.cmake")
if (EXISTS "${CONAN_BUILD_INFO_PATH}")
include("${CONAN_BUILD_INFO_PATH}")
conan_basic_setup(TARGETS)
if (ASIOCHAN_USE_STANDALONE_ASIO)
target_link_libraries(asiochan INTERFACE CONAN_PKG::asio)
else()
target_link_libraries(asiochan INTERFACE CONAN_PKG::boost)
endif()
find_package(Threads REQUIRED)
enable_testing()
add_subdirectory(examples)
add_subdirectory(tests)
endif()