Skip to content

Commit de17f11

Browse files
committed
rewrite cmake list
1 parent 20f8d9b commit de17f11

1 file changed

Lines changed: 44 additions & 7 deletions

File tree

Lines changed: 44 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,37 @@
11
cmake_minimum_required(VERSION 3.8)
22
project(gz_noisy_odometry)
33

4+
# Default to C99
5+
if(NOT CMAKE_C_STANDARD)
6+
set(CMAKE_C_STANDARD 99)
7+
endif()
8+
9+
# Default to C++14
10+
if(NOT CMAKE_CXX_STANDARD)
11+
set(CMAKE_CXX_STANDARD 14)
12+
endif()
13+
414
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
515
add_compile_options(-Wall -Wextra -Wpedantic)
616
endif()
717

18+
# ===========================================================================
19+
# find dependencies
20+
821
find_package(ament_cmake REQUIRED)
922
find_package(rclcpp REQUIRED)
1023
find_package(nav_msgs REQUIRED)
1124
find_package(tf2 REQUIRED)
1225

13-
find_package(gz-sim8 REQUIRED COMPONENTS system)
1426
find_package(gz-plugin2 REQUIRED COMPONENTS register)
15-
find_package(gz-transport13 REQUIRED)
27+
find_package(gz-sim8 REQUIRED)
1628
find_package(gz-msgs10 REQUIRED)
1729
find_package(gz-math7 REQUIRED)
30+
find_package(gz-common5 REQUIRED)
31+
find_package(gz-transport13 REQUIRED)
32+
33+
# ============================================================================
34+
# Noisy Odometry plugin
1835

1936
add_library(NoisyOdometryPlugin SHARED
2037
src/gz_noisy_odometry/NoisyOdometryPlugin.cpp
@@ -25,22 +42,42 @@ target_include_directories(NoisyOdometryPlugin PUBLIC
2542
$<INSTALL_INTERFACE:include>
2643
)
2744

45+
# Dependencias de ROS 2
2846
ament_target_dependencies(NoisyOdometryPlugin
2947
rclcpp
3048
nav_msgs
3149
tf2
3250
)
3351

52+
# Enlace de librerías de Gazebo calcando la sintaxis del proyecto que funciona
3453
target_link_libraries(NoisyOdometryPlugin
35-
gz-sim8::gz-sim8-system
36-
gz-plugin2::gz-plugin2-register
37-
gz-transport13::gz-transport13
54+
gz-plugin2::gz-plugin2
55+
gz-plugin2::register
56+
gz-sim8::gz-sim8
3857
gz-msgs10::gz-msgs10
3958
gz-math7::gz-math7
59+
gz-common5::gz-common5
60+
gz-transport13::gz-transport13
61+
)
62+
63+
install(
64+
TARGETS NoisyOdometryPlugin
65+
ARCHIVE DESTINATION lib
66+
LIBRARY DESTINATION lib
67+
RUNTIME DESTINATION bin
4068
)
4169

42-
install(TARGETS NoisyOdometryPlugin
43-
DESTINATION lib
70+
install(
71+
DIRECTORY include/
72+
DESTINATION include
4473
)
4574

75+
ament_export_include_directories(include)
76+
ament_export_libraries(NoisyOdometryPlugin)
77+
78+
if(BUILD_TESTING)
79+
find_package(ament_lint_auto REQUIRED)
80+
find_package(ament_lint_common REQUIRED)
81+
endif()
82+
4683
ament_package()

0 commit comments

Comments
 (0)