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

library dependencies

asked 2015-09-22 16:31:45 -0500

luc gravatar image

I have a catkin library that I'm trying to edit the CMakeLists.txt file for so it builds a package containing services before it compiles the package.

I just learned that in order to do this for a regular package of executables, you use the add_dependencies() keywords in Cmake. How do you go about doing this for a library?

cmake_minimum_required(VERSION 2.8.3)
project(baxter_kinematics)

find_package(cmake_modules REQUIRED)

find_package(Eigen REQUIRED)

find_package(catkin REQUIRED COMPONENTS
  roscpp
  std_msgs
  sensor_msgs
  tf
  cwru_srv
)

include_directories(
  ${Eigen_INCLUDE_DIRS}
  ${PROJECT_NAME}/include
)

add_definitions(${EIGEN_DEFINITIONS})

SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")

catkin_package(
  INCLUDE_DIRS include 
  LIBRARIES ${PROJECT_NAME}
  CATKIN_DEPENDS roscpp std_msgs sensor_msgs tf baxter_core_msgs cwru_srv
  DEPENDS eigen system_lib
)

include_directories(
  include
  ${catkin_INCLUDE_DIRS}
)

add_library(
  ${PROJECT_NAME}
  src/baxter_kinematics.cpp
 )

## Declare a cpp executable

add_executable(baxter_kinematics_test_main src/baxter_kinematics_test_main.cpp)
target_link_libraries(baxter_kinematics_test_main baxter_kinematics ${catkin_LIBRARIES})

## ???
## add_dependencies(baxter_kinematics cwru_srv)
edit retag flag offensive close merge delete

Comments

Isn't this a duplicate of having to compile msgs and srvs first?

The linked docs show you this:

add_dependencies(your_library ${catkin_EXPORTED_TARGETS})

Which completely answers your question.

gvdhoorn gravatar image gvdhoorn  ( 2015-09-23 01:58:46 -0500 )edit

Sure does. I should probably slow down a bit.. Haha, sorry about that again.

luc gravatar image luc  ( 2015-09-23 07:41:18 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2015-09-22 16:59:30 -0500

luc gravatar image

updated 2015-09-22 22:06:26 -0500

I think I got it to work by actually just un-commenting the last line (kinda)

add_dependencies(baxter_kinematics cwru_srv_gencpp)

If somebody can confirm that this is how it's done, that'd be swell.

edit flag offensive delete link more

Comments

1

I believe this is correct since add_dependency() creates dependencies between targets (either executable target or libraries).

Mani gravatar image Mani  ( 2015-09-22 17:37:07 -0500 )edit
1

Awesome, thanks.

luc gravatar image luc  ( 2015-09-22 22:06:14 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2015-09-22 16:31:45 -0500

Seen: 366 times

Last updated: Sep 22 '15