This repository has been archived by the owner on Sep 3, 2024. It is now read-only.
forked from rock-simulation/configmaps
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
88 lines (73 loc) · 2.14 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
76
77
78
79
80
81
82
83
84
85
86
87
cmake_minimum_required(VERSION 3.5)
project(configmaps VERSION "0.1.0" DESCRIPTION "This library contains a C++ implementation of python dictionary-like containers - ConfigMaps.")
find_package(yaml-cpp REQUIRED)
find_package(jsoncpp REQUIRED)
# Export the library interface
install(EXPORT configmaps-targets
NAMESPACE configmaps::
DESTINATION lib/cmake/configmaps
)
# Create and install the version file
include(CMakePackageConfigHelpers)
write_basic_package_version_file("configmaps-config-version.cmake"
VERSION ${configmaps_VERSION}
COMPATIBILITY SameMajorVersion)
install(
FILES
cmake/configmaps-config.cmake
${PROJECT_BINARY_DIR}/configmaps-config-version.cmake
DESTINATION
lib/cmake/configmaps
)
set(SOURCES
src/ConfigBase.cpp
src/ConfigItem.cpp
src/ConfigMap.cpp
src/ConfigSchema.cpp
src/ConfigVector.cpp
)
set(HEADERS
src/ConfigAtom.hpp
src/ConfigBase.hpp
src/ConfigData.h
src/ConfigItem.hpp
src/ConfigMap.hpp
src/ConfigSchema.hpp
src/ConfigVector.hpp
src/FIFOMap.h
)
add_library(configmaps SHARED ${SOURCES})
target_compile_features(configmaps PUBLIC cxx_std_17)
target_link_libraries(
configmaps
${YAML_CPP_LIBRARIES}
jsoncpp_lib
pthread
)
target_include_directories(configmaps
PUBLIC
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/src>
$<INSTALL_INTERFACE:include>
)
if(WIN32)
set(LIB_INSTALL_DIR bin) # .dll are in PATH, like executables
else(WIN32)
set(LIB_INSTALL_DIR lib)
endif(WIN32)
# Install the binaries
install(TARGETS configmaps EXPORT configmaps-targets
RUNTIME DESTINATION bin
LIBRARY DESTINATION ${LIB_INSTALL_DIR}
ARCHIVE DESTINATION lib
)
# Install headers into mars include directory
install(FILES ${HEADERS} DESTINATION include/configmaps)
# Prepare and install necessary files to support finding of the library
install(
FILES cmake/configmaps-config.cmake
DESTINATION lib/cmake/configmaps
)
# using pkg-config
configure_file(configmaps.pc.in ${CMAKE_BINARY_DIR}/configmaps.pc @ONLY)
install(FILES ${CMAKE_BINARY_DIR}/configmaps.pc DESTINATION lib/pkgconfig)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/test)