-
Notifications
You must be signed in to change notification settings - Fork 85
/
CMakeLists.txt
97 lines (75 loc) · 2.4 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
cmake_minimum_required(VERSION 3.0.2)
project(cv_camera)
find_package(catkin REQUIRED COMPONENTS
image_transport roscpp cv_bridge sensor_msgs nodelet camera_info_manager roslint)
find_package(OpenCV REQUIRED)
find_package(Boost REQUIRED COMPONENTS system thread)
roslint_cpp()
catkin_package(
INCLUDE_DIRS include
LIBRARIES cv_camera
CATKIN_DEPENDS image_transport roscpp cv_bridge sensor_msgs nodelet camera_info_manager
DEPENDS OpenCV
)
include_directories(
include
${catkin_INCLUDE_DIRS}
${Boost_INCLUDE_DIRS}
)
## Declare a cpp library
add_library(cv_camera src/capture.cpp src/driver.cpp)
add_library(cv_camera_nodelet src/cv_camera_nodelet.cpp)
## Declare a cpp executable
add_executable(cv_camera_node src/cv_camera_node.cpp)
add_dependencies(cv_camera_node cv_camera)
add_dependencies(cv_camera_nodelet cv_camera)
## Specify libraries to link a library or executable target against
target_link_libraries(cv_camera
${catkin_LIBRARIES}
${OpenCV_LIBS}
)
target_link_libraries(cv_camera_nodelet
${catkin_LIBRARIES}
cv_camera
)
target_link_libraries(cv_camera_node
${catkin_LIBRARIES}
cv_camera
)
#############
## Install ##
#############
## Mark executable scripts (Python etc.) for installation
## in contrast to setup.py, you can choose the destination
# install(PROGRAMS
# scripts/my_python_script
# DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
# )
## Mark executables and/or libraries for installation
install(TARGETS cv_camera cv_camera_nodelet cv_camera_node
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}
)
# add xml file
install(FILES cv_camera_nodelets.xml
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}
)
#############
## Testing ##
#############
roslint_cpp(
src/capture.cpp src/cv_camera_node.cpp src/cv_camera_nodelet.cpp src/driver.cpp
)
if (CATKIN_ENABLE_TESTING)
find_package(rostest REQUIRED)
add_rostest_gtest(test_cv_camera test/cv_camera.test
test/test_cv_camera.cpp)
target_link_libraries(test_cv_camera ${PROJECT_NAME} ${catkin_LIBRARIES})
add_rostest_gtest(test_cv_camera_no_yaml test/no_yaml.test
test/test_cv_camera_no_yaml.cpp)
target_link_libraries(test_cv_camera_no_yaml ${PROJECT_NAME} ${catkin_LIBRARIES})
endif()