-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
31 lines (26 loc) · 1.05 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
cmake_minimum_required(VERSION 3.18)
project(mcpp-concurrent-queue)
set(PROJECT_ALIAS mcpp::concurrent-queue)
if (CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR)
set(is_toplevel TRUE)
else ()
set(is_toplevel FALSE)
endif ()
option(${PROJECT_NAME}_WITH_TESTS "Build tests" ${is_toplevel})
option(${PROJECT_NAME}_WITH_INSTALL "Install project" ${is_toplevel})
add_library(${PROJECT_NAME} INTERFACE)
target_include_directories(${PROJECT_NAME} INTERFACE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>)
target_compile_features(${PROJECT_NAME} INTERFACE cxx_std_17)
set_target_properties(${PROJECT_NAME} PROPERTIES EXPORT_NAME ${PROJECT_ALIAS})
add_library(${PROJECT_ALIAS} ALIAS ${PROJECT_NAME})
if (${PROJECT_NAME}_WITH_INSTALL)
install(TARGETS ${PROJECT_NAME} EXPORT ${PROJECT_NAME}-config)
install(EXPORT ${PROJECT_NAME}-config DESTINATION share/cmake/${PROJECT_NAME})
install(DIRECTORY include DESTINATION ".")
endif ()
if (${PROJECT_NAME}_WITH_TESTS)
include(CTest)
add_subdirectory(tests)
endif ()