-
Notifications
You must be signed in to change notification settings - Fork 15
/
CMakeLists.txt
63 lines (51 loc) · 1.91 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
# -*- cmake -*- -----------------------------------------------------------
# @@COPYRIGHT@@
#*-------------------------------------------------------------------------
# Set the minimum CMake version:
cmake_minimum_required(VERSION 3.15)
# Allow solution folders:
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
# The project name:
project(CML)
# Path to the project source tree:
set(CML_ROOT "${CML_SOURCE_DIR}")
# Path to project-specific configuration files:
list(APPEND CMAKE_MODULE_PATH ${CML_ROOT}/CMake)
# Include project macros:
include(CMLBuildMacros)
# Figure out which version of CML is being built by parsing CML/version.h (this
# is from the root Boost.CMake CMakeLists.txt file):
cml_version_from_file(
${CML_ROOT}/cml/version.h # Path to version.h
"CML_VERSION" # The macro name to find
CML_VERSION_MAJOR # Parsed major version
CML_VERSION_MINOR # Parsed minor version
CML_VERSION_PATCH # Parsed patch version
CML_VERSION # String MM.mm.pp
)
message(STATUS "Building CML ${CML_VERSION}")
# Create the CML interface library:
include(CML.cmake)
# Build tests if requested:
option(CML_BUILD_TESTING "Build CML tests" OFF)
if(CML_BUILD_TESTING)
enable_testing()
add_subdirectory(tests)
endif()
# Installation and packaging:
include(CMakePackageConfigHelpers)
write_basic_package_version_file(
${CMAKE_CURRENT_BINARY_DIR}/cml-config-version.cmake
VERSION ${CML_VERSION}
COMPATIBILITY ExactVersion
)
include(GNUInstallDirs)
install(TARGETS cml DESTINATION ${CMAKE_INSTALL_LIBDIR} EXPORT cml-targets)
install(EXPORT cml-targets DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/cml FILE cml-targets.cmake)
install(DIRECTORY cml DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} FILES_MATCHING PATTERN "*")
install(FILES
${CMAKE_CURRENT_BINARY_DIR}/cml-config-version.cmake
CMake/cml-config.cmake
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/cml
)
export(EXPORT cml-targets FILE cml-config.cmake)