-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCMakeLists.txt
51 lines (40 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
cmake_minimum_required(VERSION 3.10 FATAL_ERROR)
project(locking_container VERSION 0.9.1 LANGUAGES CXX)
add_library(${PROJECT_NAME} INTERFACE)
target_sources(${PROJECT_NAME}
INTERFACE
${CMAKE_CURRENT_LIST_DIR}/include/${PROJECT_NAME}/locking_container.hpp
${CMAKE_CURRENT_LIST_DIR}/include/${PROJECT_NAME}/locking_container_basic.hpp
${CMAKE_CURRENT_LIST_DIR}/include/${PROJECT_NAME}/detail/macros.hpp
${CMAKE_CURRENT_LIST_DIR}/include/${PROJECT_NAME}/detail/mutex_type.hpp)
target_include_directories(${PROJECT_NAME}
INTERFACE
${CMAKE_CURRENT_LIST_DIR}/include)
target_compile_features(${PROJECT_NAME}
INTERFACE
cxx_inheriting_constructors
cxx_return_type_deduction
cxx_trailing_return_types
cxx_variadic_templates)
# The project is compatible also with the older C++ 14 (in that case it uses shared_timed_mutex)
include(CheckCXXCompilerFlag)
if (MSVC)
check_cxx_compiler_flag(/std:c++17 _cxx17_supported)
else()
check_cxx_compiler_flag(-std=c++17 _cxx17_supported)
endif()
if (_cxx17_supported)
message(STATUS "Setting C++ 17 standard")
target_compile_features(${PROJECT_NAME} INTERFACE cxx_std_17)
else()
message(STATUS "Setting C++ 14 standard")
target_compile_features(${PROJECT_NAME} INTERFACE cxx_std_14)
endif()
install(TARGETS ${PROJECT_NAME}
EXPORT _targets)
export(EXPORT _targets
NAMESPACE burda::
FILE "${PROJECT_NAME}-config.cmake")
include(CMakePackageConfigHelpers)
write_basic_package_version_file(${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-config-version.cmake
COMPATIBILITY ExactVersion)