-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
65 lines (54 loc) · 1.64 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
65
cmake_minimum_required(VERSION 3.23)
if(DEFINED ENV{VCPKG_ROOT} AND NOT DEFINED CMAKE_TOOLCHAIN_FILE)
set(CMAKE_TOOLCHAIN_FILE
"$ENV{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake"
CACHE STRING ""
)
endif()
project(
variant_view
VERSION 0.1.0
LANGUAGES CXX
)
option(YK_VARIANT_VIEW_BUILD_TESTING "build tests" ${PROJECT_IS_TOP_LEVEL})
add_library(variant_view INTERFACE)
add_library(yk::variant_view ALIAS variant_view)
file(GLOB_RECURSE VARIANT_VIEW_HEADERS CONFIGURE_DEPENDS include/*.hpp)
target_sources(
variant_view INTERFACE FILE_SET HEADERS BASE_DIRS include FILES ${VARIANT_VIEW_HEADERS}
)
include(GNUInstallDirs)
target_include_directories(
variant_view INTERFACE $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
)
set_target_properties(
variant_view
PROPERTIES CXX_STANDARD 20
CXX_STANDARD_REQUIRED ON
CXX_EXTENSIONS OFF
)
find_package(Boost COMPONENTS unit_test_framework CONFIG)
if(${Boost_FOUND})
target_compile_definitions(variant_view INTERFACE YK_VARIANT_VIEW_INCLUDE_BOOST=1)
target_link_libraries(variant_view INTERFACE Boost::headers)
endif()
install(
TARGETS variant_view
EXPORT variant_view-export
FILE_SET HEADERS
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
)
install(
EXPORT variant_view-export
FILE variant_viewTargets.cmake
NAMESPACE yk::
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake
)
if(YK_VARIANT_VIEW_BUILD_TESTING)
if(Boost_unit_test_framework_FOUND)
add_subdirectory(test EXCLUDE_FROM_ALL)
else()
message(STATUS "Boost.Test is not found, not building tests")
endif()
endif()