1
- #
2
1
# This is the Top level CMakelists file which creates the namespace and
3
2
# organizes all sublibraries under it.
4
- #
5
- # The project name in this file is considered the "Namespace"
6
- # and any libraries under it will be given a target of
7
- #
8
- # Namespace::library_name
9
- #
10
- #
11
- # This Lists file was modified from https://github.com/forexample/package-example
12
- #
13
- # This file creates project 'Foo' with two library targets 'bar' and 'cat'.
14
- # Target 'cat' depends on 'bar'. After installation this project can be found
15
- # by 'find_package(... CONFIG)' command:
16
- #
17
- # find_package(foo CONFIG REQUIRED)
18
- # target_link_libraries(... foo::bar)
19
- #
20
- # Note that requirements propagated automatically, for example:
21
- # * Foo::baz linked automatically
22
- # * <prefix>/include added to header search path
23
- # * FOO_BAZ_DEBUG=1/FOO_BAR_DEBUG=1 added on Debug
24
- # * FOO_BAZ_DEBUG=0/FOO_BAR_DEBUG=0 added on other configurations
3
+ cmake_minimum_required (VERSION 3.13)
25
4
26
- ####
27
- # Set minimum version of CMake. We need 3.13 at least.
28
- cmake_minimum_required (VERSION 3.13) # GENERATOR_IS_MULTI_CONFIG
5
+ set (PROJECT_NAME "kami" )
29
6
30
- set (KAMI_VERSION_MAJOR 0)
31
- set (KAMI_VERSION_MINOR 5)
32
- set (KAMI_VERSION_PATCH 0 )
33
- set (KAMI_VERSION_STRING ${KAMI_VERSION_MAJOR } .${KAMI_VERSION_MINOR } .${KAMI_VERSION_PATCH } )
7
+ set (VERSION_MAJOR 0)
8
+ set (VERSION_MINOR 5)
9
+ set (VERSION_PATCH 1 )
10
+ set (VERSION_STRING ${VERSION_MAJOR } .${VERSION_MINOR } .${VERSION_PATCH } )
34
11
35
- ################################################################################
36
- # Set variables for the project. The:
37
- # * PROJECT_NAME
38
- # * PROJECT_VERSION
39
- # * PROJECT_NAMESPACE should be the same as the project.
40
- project (kami VERSION ${KAMI_VERSION_STRING}
41
- LANGUAGES CXX)
12
+ project (${PROJECT_NAME}
13
+ VERSION ${VERSION_STRING}
14
+ LANGUAGES CXX)
42
15
43
16
set (CMAKE_CXX_STANDARD 20)
44
17
set (CMAKE_CXX_STANDARD_REQUIRED ON )
@@ -48,11 +21,7 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_BINARY_DIR}" CACHE STRING "M
48
21
include (${CMAKE_BINARY_DIR} /conanbuildinfo.cmake)
49
22
conan_basic_setup()
50
23
51
- set (PROJECT_NAMESPACE kami ) # The project namespace. Library targets
52
- # will be referred by
53
- # foo::bar. This value should usually be
54
- # the same as the project.
55
- ################################################################################
24
+ set (PROJECT_NAMESPACE ${PROJECT_NAME} )
56
25
57
26
find_package (spdlog)
58
27
find_package (Threads)
@@ -95,7 +64,7 @@ ENDFOREACH()
95
64
################################################################################
96
65
# Examples.
97
66
#
98
- # Each example will be built as a static or shared library and a
67
+ # Each example will be built as a static or shared binary and a
99
68
# target will be created for it.
100
69
################################################################################
101
70
@@ -125,7 +94,7 @@ include(GNUInstallDirs)
125
94
# * <prefix>/include/
126
95
set (config_install_dir "${CMAKE_INSTALL_LIBDIR} /cmake/${PROJECT_NAME} " )
127
96
128
- set (generated_dir "${CMAKE_CURRENT_BINARY_DIR} /generated" )
97
+ set (generated_dir "${CMAKE_CURRENT_BINARY_DIR} /generated" )
129
98
130
99
# Configuration
131
100
set (version_config "${generated_dir} /${PROJECT_NAME} ConfigVersion.cmake" )
@@ -158,38 +127,30 @@ configure_package_config_file(
158
127
# * <prefix>/lib/libbaz.a
159
128
# * header location after install: <prefix>/include/foo/Bar.hpp
160
129
# * headers can be included by C++ code `#include <foo/Bar.hpp>`
161
- install (
162
- TARGETS
163
- ${sub_modules} ${example_modules}
164
- ${COVERAGE_INSTALL_TARGET}
165
- EXPORT
166
- "${TARGETS_EXPORT_NAME} "
167
- LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR} "
168
- ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR} "
169
- RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR} "
170
- INCLUDES DESTINATION "${CMAKE_INSTALL_INCLUDEDIR} "
171
- )
130
+ install (
131
+ TARGETS ${sub_modules} ${example_modules} ${COVERAGE_INSTALL_TARGET}
132
+ EXPORT "${TARGETS_EXPORT_NAME} "
133
+ LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR} "
134
+ ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR} "
135
+ RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR} "
136
+ INCLUDES DESTINATION "${CMAKE_INSTALL_INCLUDEDIR} "
137
+ )
172
138
173
139
174
140
# Config
175
141
# * <prefix>/lib/cmake/Foo/FooConfig.cmake
176
142
# * <prefix>/lib/cmake/Foo/FooConfigVersion.cmake
177
143
install (
178
- FILES
179
- "${project_config} " "${version_config} "
180
- DESTINATION
181
- "${config_install_dir} "
144
+ FILES "${project_config} " "${version_config} "
145
+ DESTINATION "${config_install_dir} "
182
146
)
183
147
184
148
# Config
185
149
# * <prefix>/lib/cmake/Foo/FooTargets.cmake
186
150
install (
187
- EXPORT
188
- "${TARGETS_EXPORT_NAME} "
189
- NAMESPACE
190
- "${namespace} "
191
- DESTINATION
192
- "${config_install_dir} "
151
+ EXPORT "${TARGETS_EXPORT_NAME} "
152
+ NAMESPACE "${namespace} "
153
+ DESTINATION "${config_install_dir} "
193
154
)
194
155
195
156
add_subdirectory (docs)
0 commit comments