-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
63 lines (51 loc) · 1.83 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
cmake_minimum_required(VERSION 2.8.3)
project(ros_pioneer)
find_package(catkin REQUIRED
COMPONENTS roscpp roslib tf geometry_msgs nav_msgs)
find_package(Boost REQUIRED
COMPONENTS thread)
catkin_package(
INCLUDE_DIRS include
LIBRARIES ros_pioneer
)
set(PACKAGE_PATH "${PROJECT_SOURCE_DIR}")
configure_file(${PROJECT_SOURCE_DIR}/include/${PROJECT_NAME}/config.h.in
${PROJECT_SOURCE_DIR}/include/${PROJECT_NAME}/config.h)
include_directories(include ${catkin_INCLUDE_DIRS})
file(GLOB_RECURSE HEADERS include/${PROJECT_NAME}/*.h)
file(GLOB_RECURSE SOURCES src/*.cpp)
##############
## Coverage ##
##############
set(COVERAGE "OFF" CACHE STRING "Enable coverage generation.")
message(STATUS "Using COVERAGE: ${COVERAGE}")
if("${COVERAGE}" STREQUAL "ON")
set(CMAKE_BUILD_TYPE "Debug")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --coverage -fprofile-arcs -ftest-coverage")
endif()
##############
## Building ##
##############
add_library(${PROJECT_NAME} ${SOURCES} ${HEADERS})
target_link_libraries(${PROJECT_NAME} ${catkin_LIBRARIES})
#############
## Testing ##
#############
if(CATKIN_ENABLE_TESTING)
find_package(rostest REQUIRED)
catkin_add_gtest(test_config test/test_config.cpp)
target_link_libraries(test_config ${PROJECT_NAME})
catkin_add_gtest(test_packet test/test_packet.cpp)
target_link_libraries(test_packet ${PROJECT_NAME})
add_rostest_gtest(test_driver test/test_driver.test test/test_driver.cpp)
target_link_libraries(test_driver ${PROJECT_NAME})
endif(CATKIN_ENABLE_TESTING)
################
## Installing ##
################
install(TARGETS ${PROJECT_NAME}
LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
)
install(DIRECTORY ${CATKIN_DEVEL_PREFIX}/${CATKIN_PACKAGE_INCLUDE_DESTINATION}/
DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION}
)