opening ROS stacks in qtcreator
Opening a ROS package in qtcreator is easy thanks to the built in support for CMake projects. However, when working with stacks that contain a large number of packages it would be convenient to be able to open them all at once in qtcreator, so that you can easily jump between source/header files of multiple packages.
I added the following lines to the MY_STACK CMakeLists.txt in an attempt to achieve this:
execute_process(COMMAND rosstack contents MY_STACK OUTPUT_VARIABLE MY_STACK_PACKAGES)
set(MY_STACK_PACKAGE_LIST ${MY_STACK_PACKAGES})
string(REPLACE "\n" ";" MY_STACK_PACKAGE_LIST ${MY_STACK_PACKAGES})
foreach(package ${MY_STACK_PACKAGE_LIST})
execute_process(COMMAND rospack find ${package} OUTPUT_VARIABLE package_path OUTPUT_STRIP_TRAILING_WHITESPACE)
add_subdirectory(${package_path})
endforeach(package)
which should add all the packages in MY_STACK as subprojects of MY_STACK. This would probably work if MY_STACK was a 'normal' CMake project. However, when running cmake . in MY_STACK_PATH there are errors like:
rospack found package "MY_STACK" at "", but the current directory is "PATH_TO_MY_STACK_PACKAGE_1".
You should double-check your ROS_PACKAGE_PATH to ensure that packages are found in the correct precedence order.
Is there anyway to get around this or will I have to stick to loading all the packages in MY_STACK as separate projects in qtcreator?