-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
95 lines (70 loc) · 1.69 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
88
89
90
91
92
93
94
95
cmake_minimum_required(VERSION 3.3)
project(paraminf)
set(CMAKE_CXX_STANDARD 17)
find_package(ament_cmake REQUIRED)
find_package(PkgConfig REQUIRED)
pkg_check_modules(YAML_CPP REQUIRED yaml-cpp)
# add cmake functions
list (APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
include (add_doxygen_compile)
include (add_gtest_compile)
# add compile options
option(BUILD_SHARED_LIBS "Build shared libraries" ON)
option(BUILD_TEST "Build tests" OFF)
option(BUILD_DOC "Build documentation" OFF)
option(BUILD_ALL "Build all" OFF)
if(BUILD_ALL)
set(BUILD_TEST ON)
set(BUILD_DOC ON)
endif()
ament_export_include_directories(include)
ament_export_libraries(${PROJECT_NAME})
###########
## Build ##
###########
include_directories(
include
${yaml-cpp_INCLUDE_DIR}
${Boost_INCLUDE_DIR}
)
## Specify additional locations of header files
set(HEADERS
include/${PROJECT_NAME}/parameter_interface.h
include/${PROJECT_NAME}/yaml_io_handler.h
)
set(SOURCES
src/parameter_interface.cpp
src/yaml_io_handler.cpp
)
## Declare a cpp library
add_library(${PROJECT_NAME} ${SOURCES} ${HEADERS})
## Specify libraries to link a library or executable target against
target_link_libraries(${PROJECT_NAME} yaml-cpp)
#############
## Install ##
#############
install(
DIRECTORY include/
DESTINATION include
)
install(TARGETS
${PROJECT_NAME}
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
RUNTIME DESTINATION bin
INCLUDES DESTINATION include
DESTINATION lib/${PROJECT_NAME}
)
#############
## Testing ##
#############
set(TEST_SOURCES
test/src/yaml_parser_test.cpp
test/src/parameter_interface_test.cpp
)
add_gtest_compile()
##########
## DOCS ##
##########
add_doxygen_compile()
ament_package()