-
Notifications
You must be signed in to change notification settings - Fork 14
/
CMakeLists.txt
75 lines (62 loc) · 1.87 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
## qicore CMake project
## ================
##
## Parameters:
## -----------
## QI_CORE_VERSION
## ~~~~~~~~~~
## A version number that will be used for this project. If this variable is
## undefined, CMake will read the project version number from the
## `project.json` file in the source directory.
##
## BUILD_TESTING
## ~~~~~~~~~~~~~
## If set to true, enables building the tests. See the documentation of the
## `CTest` module for more details on this variable.
##
## Targets
## -------
## The targets defined by the project are:
## - `qicore::core`: shared library.
cmake_minimum_required(VERSION 3.23)
# - Parse project description file
file(READ "${CMAKE_CURRENT_LIST_DIR}/project.json" project_json)
# - Define the project version number.
if(NOT QI_CORE_VERSION)
string(JSON QI_CORE_VERSION GET "${project_json}" version)
endif()
include(cmake/ParseVersion.cmake)
parse_version(QI_CORE "${QI_CORE_VERSION}")
message(STATUS "Project version is ${QI_CORE_VERSION_FULL} (interpreted as ${QI_CORE_VERSION} for CMake)")
project(qicore VERSION "${QI_CORE_VERSION}")
include(CTest)
include(cmake/BuildType.cmake)
include(cmake/MakePackageConfigFile.cmake)
set(Boost_COMPONENTS filesystem thread)
find_package(
Boost REQUIRED
COMPONENTS
${Boost_COMPONENTS}
)
find_package(qi REQUIRED)
if(BUILD_TESTING)
find_package(GTest REQUIRED)
include(GoogleTest)
endif()
##############################################################################
# Convenience library: cxx_standard
##############################################################################
add_library(cxx_standard INTERFACE)
add_library(qicore::internal::cxx_standard ALIAS cxx_standard)
# The project requires at least C++17.
target_compile_features(
cxx_standard
INTERFACE
cxx_std_17
)
set_target_properties(
cxx_standard
PROPERTIES
EXPORT_NAME internal::cxx_standard
)
add_subdirectory(libqicore)