-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
64 lines (50 loc) · 1.89 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
#============================================================================
#
# Copyright (C) 2023 Ivan Pinezhaninov <ivan.pinezhaninov@gmail.com>
#
# This file is part of the async_promise which can be found at
# https://github.com/IvanPinezhaninov/async_promise/.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
# DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
# OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
# THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
#============================================================================
cmake_minimum_required(VERSION 3.1)
project(async_promise LANGUAGES CXX VERSION 1.0.0)
option(ASYNC_PROMISE_BUILD_EXAMPLE "Build example" OFF)
option(ASYNC_PROMISE_BUILD_TESTS "Build tests" OFF)
option(ASYNC_PROMISE_CODECOV "Add test coverage" OFF)
if(ASYNC_PROMISE_BUILD_EXAMPLE)
add_subdirectory(example)
endif()
if(ASYNC_PROMISE_BUILD_TESTS)
enable_testing()
add_subdirectory(tests)
endif()
find_package(Threads REQUIRED)
set(HEADERS
include/async_promise.hpp
)
set(TARGET async_promise)
add_library(${TARGET} INTERFACE)
add_library("async::promise" ALIAS ${TARGET})
target_include_directories(${TARGET} INTERFACE
${CMAKE_CURRENT_SOURCE_DIR}/include
)
target_link_libraries(${TARGET} INTERFACE
Threads::Threads
)
if(ASYNC_PROMISE_CODECOV AND CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
target_compile_options(${TARGET} INTERFACE -O0 -g --coverage)
if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.13)
target_link_options(${TARGET} INTERFACE --coverage)
else()
target_link_libraries(${TARGET} INTERFACE --coverage)
endif()
endif()
install(FILES ${HEADERS} DESTINATION include)