Ask Your Question
1

Catkin invoke script built in other package

asked 2014-06-15 12:20:18 -0600

mkoval gravatar image

I am trying to using add_custom_target to invoke a binary during the build process. This is tricky because the binary is built by another Catkin package and is installed its libexec directory. I can't figure out how to make this work when both packages are built in the same Catkin workspace. I also am not sure how to call the binary in a way that is portable between the devel and install spaces.

These seem to be two separate issues:

  1. How do make my custom target depend on the binary built by the other package? I can't simply add it as a dependency, because that would fail when the other package is in a chained workspace.
  2. What is the correct way of resolving the path to the binary? Should I use rosrun, rospack, or catkin_find? Or do I need to somehow export a CMake variable that contains the path?
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2014-06-19 18:04:47 -0600

mkoval gravatar image

I found a few other answers that hint at the solution. This is what I finally came up with that works:

I created a file my_package-extras.cmake.em that exports CMake variables that point to all of the binary files that I plan to use during the build of another Catkin project. This file detects whether we are doing a devel build or an install build---and sets the paths appropriately---by checking whether my_package_SOURCE_DIR is defined.

Finally, I added the option CFG_EXTRAS my_package-extras.cmake to the catkin_package() call. This file will be included in any CMake files that find_package(my_package). Therefore, those CMake files can use the variables defined in that file to depend on (to insure that its built) and call the binaries exported by my_package.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2014-06-15 12:20:18 -0600

Seen: 178 times

Last updated: Jun 19 '14