servo/rbs_servo_hardware/CMakeLists.txt

67 lines
1.6 KiB
CMake

cmake_minimum_required(VERSION 3.16)
project(rbs_servo_hardware LANGUAGES CXX)
if(CMAKE_CXX_COMPILER_ID MATCHES "(GNU|Clang)")
add_compile_options(-Wall -Wextra)
endif()
# find dependencies
set(THIS_PACKAGE_INCLUDE_DEPENDS
hardware_interface
pluginlib
rclcpp
rclcpp_lifecycle
realtime_tools
)
# find dependencies
find_package(ament_cmake REQUIRED)
foreach(Dependency IN ITEMS ${THIS_PACKAGE_INCLUDE_DEPENDS})
find_package(${Dependency} REQUIRED)
endforeach()
## COMPILE
add_library(
rbs_servo_hardware
SHARED
src/rbs_servo_actuator.cpp
)
target_compile_features(rbs_servo_hardware PUBLIC cxx_std_17)
target_include_directories(rbs_servo_hardware PUBLIC
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include/rbs_servo_hardware>
)
ament_target_dependencies(
rbs_servo_hardware PUBLIC
${THIS_PACKAGE_INCLUDE_DEPENDS}
)
# Causes the visibility macros to use dllexport rather than dllimport,
# which is appropriate when building the dll but not consuming it.
target_compile_definitions(${PROJECT_NAME} PRIVATE "rbs_servo_hardware_BUILDING_DLL")
# Export hardware plugins
pluginlib_export_plugin_description_file(hardware_interface rbs_servo_hardware.xml)
# INSTALL
install(
DIRECTORY include/
DESTINATION include/
)
install(TARGETS rbs_servo_hardware
EXPORT export_rbs_servo_hardware
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
RUNTIME DESTINATION bin
)
if(BUILD_TESTING)
find_package(ament_cmake_gtest REQUIRED)
endif()
## EXPORTS
ament_export_targets(export_rbs_servo_hardware HAS_LIBRARY_TARGET)
ament_export_dependencies(${THIS_PACKAGE_INCLUDE_DEPENDS})
ament_package()