|
| 1 | +diff --git a/CMakeLists.txt b/CMakeLists.txt |
| 2 | +index 0115283..c036ddc 100644 |
1 | 3 | --- a/CMakeLists.txt |
2 | 4 | +++ b/CMakeLists.txt |
3 | | -@@ -8,7 +8,7 @@ find_package(catkin REQUIRED COMPONENTS |
4 | | - ) |
| 5 | +@@ -20,18 +20,6 @@ find_package(eigen3_cmake_module REQUIRED) |
| 6 | + find_package(Eigen3 REQUIRED) |
| 7 | + find_package(ament_cmake_python REQUIRED) |
5 | 8 |
|
6 | | - find_package(Eigen REQUIRED) |
7 | | --pkg_check_modules(YAML yaml-cpp) |
8 | | -+find_package(yaml-cpp REQUIRED) |
9 | | - |
10 | | - ################################### |
11 | | - ## catkin specific configuration ## |
12 | | -@@ -28,15 +28,16 @@ include_directories(include) |
13 | | - include_directories( |
14 | | - ${catkin_INCLUDE_DIRS} |
15 | | - ${Eigen_INCLUDE_DIRS} |
16 | | -- ${YAML_INCLUDEDIR} |
| 9 | +-# Set common dependencies in a variable |
| 10 | +-set(imu_calib_deps |
| 11 | +- rclcpp |
| 12 | +- sensor_msgs |
| 13 | +- std_msgs |
| 14 | +- yaml-cpp |
| 15 | +- Eigen3 |
| 16 | +-) |
| 17 | +- |
| 18 | +-# Include directories (global) |
| 19 | +-include_directories(include) |
| 20 | +- |
| 21 | + # === Build shared library from core components === |
| 22 | + add_library(imu_calib_lib |
| 23 | + src/apply_calib.cpp |
| 24 | +@@ -44,20 +32,23 @@ target_include_directories(imu_calib_lib PUBLIC |
| 25 | + $<INSTALL_INTERFACE:include> |
17 | 26 | ) |
18 | 27 |
|
19 | | - # accel_calib library |
20 | | - add_library(accel_calib |
21 | | - src/accel_calib/accel_calib.cpp |
22 | | - ) |
23 | | --target_link_libraries(accel_calib |
24 | | -- ${YAML_LIBRARIES} |
25 | | --) |
26 | | -+if(TARGET yaml-cpp::yaml-cpp) |
27 | | -+ target_link_libraries(accel_calib yaml-cpp::yaml-cpp) |
28 | | -+else() |
29 | | -+ target_link_libraries(accel_calib yaml-cpp) |
30 | | -+endif() |
31 | | - |
32 | | - # do_calib node |
33 | | - add_executable(do_calib src/do_calib_node.cpp src/do_calib.cpp) |
| 28 | +-target_link_libraries(imu_calib_lib yaml-cpp) |
| 29 | +-ament_target_dependencies(imu_calib_lib ${imu_calib_deps}) |
| 30 | ++target_link_libraries(imu_calib_lib PUBLIC |
| 31 | ++ rclcpp::rclcpp |
| 32 | ++ ${sensor_msgs_TARGETS} |
| 33 | ++ ${std_msgs_TARGETS} |
| 34 | ++ Eigen3::Eigen |
| 35 | ++ yaml-cpp::yaml-cpp |
| 36 | ++) |
| 37 | + |
| 38 | + # === Build executables === |
| 39 | + |
| 40 | + # apply_calib_node |
| 41 | + add_executable(apply_calib_node src/apply_calib_node.cpp) |
| 42 | +-target_link_libraries(apply_calib_node imu_calib_lib) |
| 43 | +-ament_target_dependencies(apply_calib_node ${imu_calib_deps}) |
| 44 | ++target_link_libraries(apply_calib_node PRIVATE imu_calib_lib) |
| 45 | + |
| 46 | + # do_calib_node |
| 47 | + add_executable(do_calib_node src/do_calib_node.cpp) |
| 48 | +-target_link_libraries(do_calib_node imu_calib_lib) |
| 49 | +-ament_target_dependencies(do_calib_node ${imu_calib_deps}) |
| 50 | ++target_link_libraries(do_calib_node PRIVATE imu_calib_lib) |
| 51 | + |
| 52 | + |
| 53 | + |
0 commit comments