Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DEPENDS in catkin_package() not adding package INCLUDE_DIRS #552

Closed
po1 opened this issue Nov 27, 2013 · 2 comments
Closed

DEPENDS in catkin_package() not adding package INCLUDE_DIRS #552

po1 opened this issue Nov 27, 2013 · 2 comments
Labels

Comments

@po1
Copy link

po1 commented Nov 27, 2013

... or more accurately, not adding PACKAGE_INCLUDE_DIRS (note the uppercase).

This issue was triggered in gazebo_ros_control.
In the CMakeLists.txt, we can see something similar to the following:

catkin_package(gazebo_ros_control
  [...]
  DEPENDS gazebo
)

What catkin does when we specify this is to add ${gazebo_INCLUDE_DIRS} to PROJECT_CMAKE_CONFIG_INCLUDE_DIRS, which is ultimately appended to catkin_INCLUDE_DIRS of whatever projects that uses find_package(catkin COMPONENTS gazebo_ros_control)

A quick glance inside of gazebo-config.cmake reveals that the variable that is set is GAZEBO_INCLUDE_DIRS (note the uppercase), which is what is recommended in the CMake tutorials.

The result is that if package foo uses find_package(catkin COMPONENTS gazebo_ros_control) will not have gazebo include dirs in its catkin_INCLUDE_DIRS, and will result in a build fail at first, and then in a declaration of an unnecessary dependency of foo to gazebo.

Another workaround is to change the CMakeLists.txt in gazebo_ros_control to the following:

catkin_package(gazebo_ros_control
  [...]
  DEPENDS GAZEBO
)

I don't know exactly what should be done here. If I understand the problem correctly, catkin has no way to guess the case of the XY_INCLUDE_DIRS variables, and assumes that the case is the same as that of the package name. Also, I could not find a mention of this case subtlety anywhere in the doc, and thought that it would be at least worth mentioning.

@dirk-thomas
Copy link
Member

Since catkin has no way of guessing the case (and should not just try to use all possible cases). It uses the name exactly as passed to catkin_package(DEPENDS).

In this case where the package defines all uppercase variable you need to pass an all uppercase package name to DEPENDS. Therefore please fill this issue against gazebo_ros_control and suggest your above fix to that package.

@wjwwood
Copy link
Member

wjwwood commented Nov 27, 2013

catkin has no way to guess the case of the XY_INCLUDE_DIRS variables, and assumes that the case is the same as that of the package name

That is exactly correct, if the package does not follow the convention where <pkg_name> is used consistently in find_package(<pkg_name> ...) and resulting variables like <pkg_name>_INCLUDE_DIRS, then catkin cannot determine it automatically.

In times like this you must manually pass include directories and libraries to the catkin_export call, and you cannot depend on the DEPENDS syntactic sugar.

For the documentation, I think it is already ticked here: #491

cwecht pushed a commit to cwecht/catkin that referenced this issue Mar 20, 2018
Port active trajectory checks and subscriber shutdown logic into FinishTrajectory(), so that a trajectory can be cleanly finished by function call.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants