How do I conditionally include a catkin component only for testing?
I'm trying to include unit tests in my catkin package (moveit_core), but they require a support package (moveit_resources) which I do not want to be required for normal installation of the main package (moveit_core).
This page: http://docs.ros.org/hydro/api/catkin/html/howto/index.html#configuring-and-running-unit-tests says that the correct thing for unit tests is to test the CMake variable CATKIN_ENABLE_TESTING. But that option is defined in the catkin cmake files, so it won't be available until after the "find_package(catkin ...)" call. The support package I want to conditionally include would be an argument to that same find_package(catkin ...) call, so I can't do it that way.
If I just do it the typical cmake way with an explicit "find_package(moveit_resources)" and then check the variable moveit_resources_FOUND, it comes up false when I first run catkin_make and true on subsequent runs of catkin_make. This means I do have a workaround for my automated testing, but it means running catkin_make multiple times, which is slower.
So is there some way to simulate what find_package(catkin...) does for components even when they are not installed, when they are still just source packages in the current workspace?
Or maybe package.xml's test_depends tag could be put to use here? (see http://answers.ros.org/question/115526/is-test_depend-actually-used-for-anything/ )
Any help is appreciated. Thanks, Dave
I just filed this bug: https://github.com/ros-infrastructure/catkin_pkg/issues/83 against catkin_pkg. As far as I can see, find_package(moveit_resources) fails the first time because moveit_resources comes later in the topological order.