The variable is defined since catkin 0.5.64: https://github.com/ros/catkin/blob/groovy-devel/CHANGELOG.rst#0564-2013-03-08

Could it be that there are just no exported targets? That could be the case if only packages have been find_package()-ed which do not export targets. Than the `add_dependency()` is not necessary and can either be removed or must be done conditionally only if the variable is not emty.