forked from wjwwood/serial
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
51 lines (38 loc) · 1.63 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
cmake_minimum_required(VERSION 3.15)
project(serial VERSION 0.1.0)
option(SERIAL_BUILD_EXAMPLES "Build examples" OFF)
# ==============================================================================
# Global internal configuration
# ==============================================================================
set(CMAKE_CXX_STANDARD 17)
include(CMakePackageConfigHelpers)
include(GNUInstallDirs)
# ==============================================================================
# Targets
# ==============================================================================
add_subdirectory(src)
if (SERIAL_BUILD_EXAMPLES)
add_subdirectory(examples)
endif ()
# ==============================================================================
# Exports and remaining installation
# ==============================================================================
configure_package_config_file(cmake/config.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/serial-config.cmake
INSTALL_DESTINATION ${CMAKE_INSTALL_DATADIR}/serial
NO_SET_AND_CHECK_MACRO)
write_basic_package_version_file(
${CMAKE_CURRENT_BINARY_DIR}/serial-config-version.cmake
VERSION ${serial_VERSION}
COMPATIBILITY SameMajorVersion)
install(
FILES
${CMAKE_CURRENT_BINARY_DIR}/serial-config.cmake
${CMAKE_CURRENT_BINARY_DIR}/serial-config-version.cmake
DESTINATION
${CMAKE_INSTALL_DATADIR}/serial)
install(TARGETS serial EXPORT serial-targets)
install(DIRECTORY include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
install(EXPORT serial-targets
NAMESPACE serial::
DESTINATION ${CMAKE_INSTALL_DATADIR}/serial)