-
Notifications
You must be signed in to change notification settings - Fork 3
/
CMakeLists.txt
79 lines (63 loc) · 1.87 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
cmake_minimum_required(VERSION 3.5)
project(ros2_time)
# Add support for C++14
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14")
## Find catkin macros and libraries
## if COMPONENTS list like find_package(catkin REQUIRED COMPONENTS xyz)
## is used, also find other catkin packages
find_package(ament_cmake REQUIRED)
find_package(rclcpp REQUIRED)
find_package(std_msgs REQUIRED)
# List of all necessary header directories
set(INCLUDE_DIRS
include
${rclcpp_INCLUDE_DIRS}
${std_msgs_INCLUDE_DIRS}
)
include_directories(${INCLUDE_DIRS})
set(LIBS
${rclcpp_LIBRARIES}
${std_msgs_LIBRARIES}
)
#### ros2_time library
add_library(${PROJECT_NAME} SHARED
src/time.cpp
src/duration.cpp
)
target_link_libraries(${PROJECT_NAME} ${LIBS})
set(LIBS ${LIBS} ${PROJECT_NAME})
############################################################
# Define tests
#
if(BUILD_TESTING)
find_package(ament_lint_auto REQUIRED)
ament_lint_auto_find_test_dependencies()
ament_add_gtest(ros2_time_tests test/time_tests.cpp)
target_link_libraries(ros2_time_tests ${LIBS})
ament_add_gtest(ros2_duration_tests test/duration_tests.cpp)
target_link_libraries(ros2_duration_tests ${LIBS})
endif()
############################################################
# Define installation rules
#
install(
TARGETS ${PROJECT_NAME}
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
RUNTIME DESTINATION bin
)
## Mark cpp header files for installation
install(
DIRECTORY include/${PROJECT_NAME}/
DESTINATION include/${PROJECT_NAME}
FILES_MATCHING PATTERN "*.hpp"
PATTERN ".svn" EXCLUDE
)
# Export include dependencies, directories, and libraries
ament_export_dependencies(ament_cmake)
ament_export_dependencies(rclcpp)
ament_export_dependencies(std_msgs)
ament_export_include_directories(${INCLUDE_DIRS})
ament_export_libraries(${PROJECT_NAME} ${LIBS})
# Must be at the bottom
ament_package()