From 95ff99bdf1549dda67390ec5c3d98601c1a9c9eb Mon Sep 17 00:00:00 2001 From: Jose Luis Rivero Date: Wed, 18 Sep 2024 12:51:27 +0200 Subject: [PATCH] Generalize gz vendor use and modernize CMake Signed-off-by: Jose Luis Rivero --- .../irobot_create_toolbox/CMakeLists.txt | 34 +++++++++++-------- .../irobot_create_gz_plugins/CMakeLists.txt | 2 +- .../Create3Hmi/CMakeLists.txt | 16 ++++----- 3 files changed, 28 insertions(+), 24 deletions(-) diff --git a/irobot_create_common/irobot_create_toolbox/CMakeLists.txt b/irobot_create_common/irobot_create_toolbox/CMakeLists.txt index 811a9358..23962bf8 100644 --- a/irobot_create_common/irobot_create_toolbox/CMakeLists.txt +++ b/irobot_create_common/irobot_create_toolbox/CMakeLists.txt @@ -11,42 +11,46 @@ if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") endif() find_package(ament_cmake REQUIRED) -find_package(gz-math7 REQUIRED) +find_package(gz_math_vendor REQUIRED) +find_package(gz-math REQUIRED) find_package(rclcpp REQUIRED) #### Libraries -set(dependencies - gz-math7 - rclcpp -) - add_library(irobot_create_toolbox SHARED) target_sources( irobot_create_toolbox PRIVATE src/polar_coordinates.cpp ) -target_include_directories(irobot_create_toolbox PUBLIC include) -ament_target_dependencies(irobot_create_toolbox - ${dependencies} +target_include_directories(irobot_create_toolbox PUBLIC + "$" + "$") + +target_link_libraries(irobot_create_toolbox + PUBLIC + gz-math::gz-math + ${rclcpp_TARGETS} ) #### Install -install(TARGETS irobot_create_toolbox +install(TARGETS + ${PROJECT_NAME} EXPORT export_${PROJECT_NAME} ARCHIVE DESTINATION lib LIBRARY DESTINATION lib RUNTIME DESTINATION bin ) install(DIRECTORY include/ - DESTINATION include + DESTINATION include/${PROJECT_NAME} +) +ament_export_targets(export_${PROJECT_NAME}) +ament_export_dependencies( + gz_math_vendor + gz-math + rclcpp ) - -ament_export_include_directories(include) -ament_export_libraries(irobot_create_toolbox) -ament_export_dependencies(${dependencies}) if(BUILD_TESTING) find_package(ament_lint_auto REQUIRED) diff --git a/irobot_create_gz/irobot_create_gz_plugins/CMakeLists.txt b/irobot_create_gz/irobot_create_gz_plugins/CMakeLists.txt index 3f86601f..d174d17f 100644 --- a/irobot_create_gz/irobot_create_gz_plugins/CMakeLists.txt +++ b/irobot_create_gz/irobot_create_gz_plugins/CMakeLists.txt @@ -11,7 +11,7 @@ find_package(ament_cmake REQUIRED) set(OpenGL_GL_PREFERENCE LEGACY) # Find the Ignition gui library -find_package(gz-gui8 REQUIRED) +find_package(gz_gui_vendor REQUIRED) add_subdirectory(Create3Hmi) if(BUILD_TESTING) diff --git a/irobot_create_gz/irobot_create_gz_plugins/Create3Hmi/CMakeLists.txt b/irobot_create_gz/irobot_create_gz_plugins/Create3Hmi/CMakeLists.txt index 721c1ca2..34658408 100644 --- a/irobot_create_gz/irobot_create_gz_plugins/Create3Hmi/CMakeLists.txt +++ b/irobot_create_gz/irobot_create_gz_plugins/Create3Hmi/CMakeLists.txt @@ -6,7 +6,8 @@ endif() set(CMAKE_AUTOMOC ON) -# Find Qt5 +find_package(gz_gui_vendor REQUIRED) +find_package(gz-gui REQUIRED) find_package(Qt5 COMPONENTS Core @@ -15,8 +16,6 @@ find_package(Qt5 REQUIRED ) -find_package(gz-gui8 REQUIRED) - qt5_add_resources(resources_rcc Create3Hmi.qrc) add_library( @@ -32,16 +31,17 @@ include_directories( ${Qt5Quick_INCLUDE_DIRS} ${Qt5QuickControls2_INCLUDE_DIRS} ) -target_link_libraries( - Create3Hmi +target_link_libraries(Create3Hmi + PUBLIC + gz-gui::gz-gui ${Qt5Core_LIBRARIES} ${Qt5Qml_LIBRARIES} ${Qt5Quick_LIBRARIES} ${Qt5QuickControls2_LIBRARIES} ) -ament_target_dependencies( - Create3Hmi - gz-gui8 +ament_target_dependencies(Create3Hmi + gz_gui_vendor + gz-gui::gz-gui ) install(