NAV2_PLUGIN/CMakeLists.txt
2023-04-12 11:02:14 +08:00

63 lines
1.4 KiB
CMake

cmake_minimum_required(VERSION 3.5)
project(nav2_gradient_costmap_plugin)
set(lib_name ${PROJECT_NAME}_core)
# === Environment ===
# 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()
# === Dependencies ===
find_package(ament_cmake REQUIRED)
find_package(rclcpp REQUIRED)
find_package(nav2_costmap_2d REQUIRED)
find_package(pluginlib REQUIRED)
find_package(std_msgs REQUIRED)
find_package(geometry_msgs REQUIRED)
add_executable(talker src/publisher_function.cpp)
ament_target_dependencies(talker rclcpp geometry_msgs)
set(dep_pkgs
rclcpp
nav2_costmap_2d
pluginlib)
# === Build ===
add_library(${lib_name} SHARED
src/gradient_layer.cpp)
include_directories(include)
# === Installation ===
install(TARGETS ${lib_name}
DESTINATION lib)
install(TARGETS
talker
DESTINATION lib/${PROJECT_NAME})
# === Ament work ===
# pluginlib_export_plugin_description_file() installs gradient_layer.xml
# file into "share" directory and sets ament indexes for it.
# This allows the plugin to be discovered as a plugin of required type.
pluginlib_export_plugin_description_file(nav2_costmap_2d gradient_layer.xml)
ament_target_dependencies(${lib_name} ${dep_pkgs})
ament_package()