46 lines
1.4 KiB
CMake
46 lines
1.4 KiB
CMake
cmake_minimum_required(VERSION 3.8)
|
|
project(image_publisher)
|
|
|
|
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
|
add_compile_options(-Wall -Wextra -Wpedantic)
|
|
endif()
|
|
|
|
# find dependencies
|
|
find_package(ament_cmake REQUIRED)
|
|
find_package(rclcpp REQUIRED)
|
|
find_package(rclcpp_components REQUIRED)
|
|
find_package(image_transport REQUIRED)
|
|
find_package(sensor_msgs REQUIRED)
|
|
find_package(OpenCV REQUIRED)
|
|
find_package(cv_bridge REQUIRED)
|
|
|
|
add_library(image_publisher_component SHARED src/ImagePublisher.cpp)
|
|
target_include_directories(image_publisher_component PUBLIC
|
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
|
|
$<INSTALL_INTERFACE:include/${PROJECT_NAME}>)
|
|
target_compile_features(image_publisher_component PUBLIC c_std_99 cxx_std_17) # Require C99 and C++17
|
|
target_link_libraries(image_publisher_component
|
|
rclcpp::rclcpp
|
|
rclcpp_components::component
|
|
image_transport::image_transport
|
|
${sensor_msgs_TARGETS}
|
|
${std_msgs_TARGETS}
|
|
${OpenCV_LIBS}
|
|
cv_bridge::cv_bridge
|
|
)
|
|
|
|
rclcpp_components_register_node(image_publisher_component
|
|
PLUGIN "j7s::ImagePublisher"
|
|
EXECUTABLE image_publisher
|
|
)
|
|
|
|
ament_export_targets(export_image_publisher_component)
|
|
install(TARGETS image_publisher_component
|
|
EXPORT export_image_publisher_component
|
|
ARCHIVE DESTINATION lib
|
|
LIBRARY DESTINATION lib
|
|
RUNTIME DESTINATION bin
|
|
)
|
|
|
|
ament_package()
|