-
Notifications
You must be signed in to change notification settings - Fork 6
/
CMakeLists.txt
106 lines (86 loc) · 2.76 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
96
97
98
99
100
101
102
103
104
105
106
cmake_minimum_required(VERSION 3.0.2)
project(rcomponent)
add_compile_options(-std=c++11)
find_package(catkin REQUIRED COMPONENTS
roscpp
std_msgs
std_srvs
robotnik_msgs
diagnostic_msgs
diagnostic_updater
self_test
)
catkin_python_setup()
catkin_package(
INCLUDE_DIRS
include
LIBRARIES
${PROJECT_NAME}
CATKIN_DEPENDS
robotnik_msgs
DEPENDS
)
include_directories(
include
${catkin_INCLUDE_DIRS}
)
## Declare a cpp library
add_library(rcomponent
include/rcomponent/rcomponent.h
include/rcomponent/rcomponent_log_macros.h
src/rcomponent.cpp
)
## Declare a cpp executable
add_executable(rcomponent_server src/simple_service_component.cpp)
add_executable(rcomponent_simple src/simple_component.cpp)
add_executable(rcomponent_simple_async src/simple_component_async.cpp)
add_executable(rcomponent_diagnostic src/simple_diagnostics_component.cpp)
## Add cmake target dependencies of the executable/library
## as an example, message headers may need to be generated before nodes
add_dependencies(rcomponent robotnik_msgs_generate_messages_cpp)
add_dependencies(rcomponent_server robotnik_msgs_generate_messages_cpp)
add_dependencies(rcomponent_simple robotnik_msgs_generate_messages_cpp)
add_dependencies(rcomponent_simple_async robotnik_msgs_generate_messages_cpp)
add_dependencies(rcomponent_diagnostic robotnik_msgs_generate_messages_cpp)
target_link_libraries(rcomponent_server
rcomponent
${catkin_LIBRARIES}
)
target_link_libraries(rcomponent_simple
rcomponent
${catkin_LIBRARIES}
)
target_link_libraries(rcomponent_simple_async
rcomponent
${catkin_LIBRARIES}
)
target_link_libraries(rcomponent_diagnostic
rcomponent
${catkin_LIBRARIES}
)
#############
## Install ##
#############
## Mark executables and/or libraries for installation
install(TARGETS rcomponent
ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
)
install(DIRECTORY include/${PROJECT_NAME}/
DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION}
FILES_MATCHING PATTERN "*.h"
)
#############
## Testing ##
#############
if(CATKIN_ENABLE_TESTING)
find_package(rostest REQUIRED)
find_package(rosunit REQUIRED)
## catkin_add_gtest(rosunit_rcomponent test/rosunit_rcomponent.cpp)
## target_link_libraries(rosunit_rcomponent ${catkin_LIBRARIES} rcomponent)
add_rostest_gtest(rosunit_rcomponent_log test/rosunit_rcomponent_log.test test/rosunit_rcomponent_log.cpp)
target_link_libraries(rosunit_rcomponent_log ${catkin_LIBRARIES} rcomponent)
add_executable(test_namespace test/test_namespace.cpp)
target_link_libraries(test_namespace ${catkin_LIBRARIES} rcomponent)
endif()