-
Notifications
You must be signed in to change notification settings - Fork 24
/
CMakeLists.txt
110 lines (92 loc) · 2.95 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
107
108
109
110
cmake_minimum_required(VERSION 3.5)
project(rt_usb_9axisimu_driver)
# Default to C99
if(NOT CMAKE_C_STANDARD)
set(CMAKE_C_STANDARD 99)
endif()
# Default to C++14
if(NOT CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 14)
endif()
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wall -Wextra -Wpedantic)
endif()
message(STATUS "CMake Version: ${CMAKE_VERSION}")
message(STATUS "C++ Compiler: ${CMAKE_CXX_COMPILER}")
message(STATUS "C++ Compiler Version: ${CMAKE_CXX_COMPILER_VERSION}")
message(STATUS "C++ Standard: ${CMAKE_CXX_STANDARD}")
# find dependencies
find_package(ament_cmake REQUIRED)
find_package(rclcpp REQUIRED)
find_package(rclcpp_components REQUIRED)
find_package(rclcpp_lifecycle REQUIRED)
find_package(sensor_msgs REQUIRED)
find_package(std_msgs REQUIRED)
find_package(std_srvs REQUIRED)
include_directories(include)
add_library(rt_usb_9axisimu_driver_component SHARED
src/rt_usb_9axisimu_driver_component.cpp
src/rt_usb_9axisimu_driver.cpp)
target_compile_definitions(rt_usb_9axisimu_driver_component
PRIVATE "RT_USB_9AXISIMU_DRIVER_BUILDING_DLL")
ament_target_dependencies(rt_usb_9axisimu_driver_component
rclcpp
rclcpp_components
rclcpp_lifecycle
sensor_msgs
std_msgs
std_srvs)
rclcpp_components_register_nodes(rt_usb_9axisimu_driver_component "rt_usb_9axisimu_driver::Driver")
add_executable(rt_usb_9axisimu_driver src/rt_usb_9axisimu_driver_node.cpp)
target_link_libraries(rt_usb_9axisimu_driver rt_usb_9axisimu_driver_component)
ament_target_dependencies(rt_usb_9axisimu_driver
rclcpp)
ament_export_targets(export_${PROJECT_NAME} HAS_LIBRARY_TARGET)
ament_export_dependencies(rclcpp)
ament_export_dependencies(rclcpp_components)
ament_export_dependencies(rclcpp_lifecycle)
ament_export_dependencies(sensor_msgs)
ament_export_dependencies(std_msgs)
ament_export_dependencies(std_srvs)
ament_export_include_directories(include)
ament_export_libraries(
rt_usb_9axisimu_driver_component)
install(
DIRECTORY include/
DESTINATION include
)
install(TARGETS
rt_usb_9axisimu_driver_component
EXPORT export_${PROJECT_NAME}
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
RUNTIME DESTINATION bin
INCLUDES DESTINATION include)
install(TARGETS
rt_usb_9axisimu_driver
DESTINATION lib/${PROJECT_NAME})
# launch files
install(DIRECTORY
launch
DESTINATION share/${PROJECT_NAME}/
)
if(BUILD_TESTING)
# find_package(ament_lint_auto REQUIRED)
# ament_lint_auto_find_test_dependencies()
Set(FETCHCONTENT_QUIET FALSE)
include(FetchContent)
FetchContent_Declare(
fakeit
GIT_REPOSITORY https://github.com/eranpeer/FakeIt
GIT_TAG 2.4.0
GIT_PROGRESS TRUE)
FetchContent_MakeAvailable(fakeit)
find_package(ament_cmake_gtest)
ament_add_gtest(test_driver test/test_driver.cpp src/rt_usb_9axisimu_driver.cpp)
target_include_directories(test_driver PRIVATE ${fakeit_SOURCE_DIR}/single_header/gtest)
ament_target_dependencies(test_driver
rclcpp
sensor_msgs
)
endif()
ament_package()