On Fri, Jun 7, 2013 at 5:31 PM, William Woodall <notifications@github.com>wrote:

> @jbohren <https://github.com/jbohren> I suppose it could, but what would
> the arguments be and how/when would that be used?
>
>
I just ran into this problem where someone added the following to a package
to supposedly get it to build:
`add_dependencies(${PROJECT_NAME} ${catkin_EXPORTED_TARGETS})`

And on my system, `${catkin_EXPORTED_TARGETS}` is not defined, so the world
explodes. So I needed to add a check for this variable. If I was a novice
and I came across those three lines, I would be very confused, and I think
we're going to see them multiple times in MANY packages. I think we should
create a macro:

`add_catkin_dependencies(target1 [[target2] target3] ...)`

Which does this check and automatically.

Frankly I think that we should modify CMake so that there's a
$PROJECT_TARGETS variable or `get_project_targets()` macro which gives you
all the targets in a given CMake project. Or alternatively a
`add_project_dependencies(...)` which adds dependencies to all targets in a
project:

For example, when you call add_executable(), this happens:
https://github.com/Kitware/CMake/blob/master/Source/cmAddExecutableCommand.cxx#L101
https://github.com/Kitware/CMake/blob/master/Source/cmMakefile.cxx#L4134

So I think we should be able to access this information at configure time.

-j

-- 
Jonathan Bohren
Laboratory for Computational Sensing and Robotics
http://dscl.lcsr.jhu.edu/People/JonathanBohren