-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
93 lines (75 loc) · 1.83 KB
/
CMakeLists.txt
File metadata and controls
93 lines (75 loc) · 1.83 KB
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
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)
if (${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR})
set(EZY_IS_TOP_LEVEL ON)
else()
set(EZY_IS_TOP_LEVEL OFF)
endif ()
project(ezy
LANGUAGES CXX
VERSION 0.0.3
)
option(EZY_BUILD_TESTS "Build ezy tests" ON)
option(EZY_BUILD_EXAMPLES "Build ezy examples" ON)
message(STATUS "Configuring: ezy (${PROJECT_VERSION})")
if (EZY_IS_TOP_LEVEL)
message(STATUS " EZY_BUILD_TESTS=${EZY_BUILD_TESTS}")
message(STATUS " EZY_BUILD_EXAMPLES=${EZY_BUILD_EXAMPLES}")
endif ()
add_library(ezy INTERFACE)
add_library(ezy::ezy ALIAS ezy)
target_include_directories(ezy
INTERFACE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>
)
if (EZY_BUILD_TESTS AND EZY_IS_TOP_LEVEL)
add_subdirectory(tests)
endif ()
if (EZY_BUILD_EXAMPLES AND EZY_IS_TOP_LEVEL)
add_subdirectory(examples)
endif ()
##
## # testing
## enable_testing()
## add_subdirectory( tests )
##
if (EZY_IS_TOP_LEVEL)
install(
TARGETS
ezy
EXPORT
EzyTargets
DESTINATION
${CMAKE_INSTALL_LIBDIR}
)
install(
EXPORT
EzyTargets
NAMESPACE
ezy::
DESTINATION
lib/cmake/ezy
)
install(
DIRECTORY include/ezy
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
)
include(CMakePackageConfigHelpers)
configure_package_config_file(
${CMAKE_CURRENT_SOURCE_DIR}/cmake/Config.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/ezy-config.cmake
INSTALL_DESTINATION lib/cmake/ezy
)
write_basic_package_version_file(
${CMAKE_CURRENT_BINARY_DIR}/ezy-config-version.cmake
VERSION "${PROJECT_VERSION}"
COMPATIBILITY AnyNewerVersion
)
install(
FILES
${CMAKE_CURRENT_BINARY_DIR}/ezy-config.cmake
${CMAKE_CURRENT_BINARY_DIR}/ezy-config-version.cmake
DESTINATION
lib/cmake/ezy
)
endif ()