ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

ok i manege to arrange my CMakeLists now for A its:

cmake_minimum_required(VERSION 3.5)
project(ur_interface)

# 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 17)
endif()

if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
  add_compile_options(-Wall -Wextra -Wpedantic)
endif()


include_directories(include)
# find dependencies
find_package(ament_cmake REQUIRED)
find_package(ur_rtde REQUIRED)
find_package(tf2 REQUIRED)

add_library(ur_interface src/UrInterface.cpp)

target_include_directories(ur_interface  PUBLIC
  $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
  $<INSTALL_INTERFACE:include>)

target_link_libraries(ur_interface  ur_rtde::rtde tf2::tf2)


ament_export_targets(ur_interface HAS_LIBRARY_TARGET)

if i add PRIVATE to target_link_libraries i get the same error as before if i use find_package. if i dont use find_package i get the error:

fatal error: tf2/LinearMath/Quaternion.h: No such file or directory
    8 | #include <tf2/LinearMath/Quaternion.h>

in package.xml of package i only use: <depend>ur_interface</depend>. maybe i mess some dependency link?