-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
101 lines (79 loc) · 2.21 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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
cmake_minimum_required(VERSION 3.14)
project(
furi
LANGUAGES
CXX
VERSION
1.0.0
)
set(CMAKE_CXX_STANDARD 17 CACHE STRING "Required C++ standard")
if(CMAKE_CXX_STANDARD LESS 17)
message(FATAL_ERROR "Minimum C++17 version not met!")
endif()
find_package(Boost 1.71 REQUIRED)
include(GNUInstallDirs)
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
add_library(
furi
src/parse_uri.cpp
)
target_include_directories(
furi
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME}-${PROJECT_VERSION}>
)
target_link_libraries(furi PUBLIC Boost::headers)
include(CTest)
if (BUILD_TESTING)
include("cmake/FuriAddTest.cmake")
add_subdirectory(test)
endif()
option(
FURI_ADD_SUBDIRECTORY
"set(FURI_ADD_SUBDIRECTORY ON CACHE BOOL \"\") to disable installation rules allowing Furi to support add_subdirectory"
OFF
)
if (FURI_ADD_SUBDIRECTORY)
add_library(Furi::furi ALIAS furi)
endif()
if (NOT FURI_ADD_SUBDIRECTORY)
install(
TARGETS
furi
EXPORT
furi-targets
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)
install(
EXPORT
furi-targets
NAMESPACE Furi::
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}-${PROJECT_VERSION}
)
install(
DIRECTORY
include/
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME}-${PROJECT_VERSION}
FILES_MATCHING PATTERN "*.hpp"
)
include(CMakePackageConfigHelpers)
write_basic_package_version_file(
${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-config-version.cmake
VERSION ${PROJECT_VERSION}
COMPATIBILITY AnyNewerVersion
)
configure_package_config_file(
${CMAKE_CURRENT_LIST_DIR}/cmake/${PROJECT_NAME}-config.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-config.cmake
INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}-${PROJECT_VERSION}
)
install(
FILES
${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-config.cmake
${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-config-version.cmake
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}-${PROJECT_VERSION}
)
endif()