diff --git a/core/roslang/cmake/roslang.cmake b/core/roslang/cmake/roslang.cmake index f4658162..98e943a5 100644 --- a/core/roslang/cmake/roslang.cmake +++ b/core/roslang/cmake/roslang.cmake @@ -21,17 +21,19 @@ foreach(_l ${_roslang_LANGS}) endforeach(_l) # Hack to resolve languages from wet which rospack does not support yet -find_package(catkin REQUIRED COMPONENTS genmsg) -foreach(_l ${CATKIN_MESSAGE_GENERATORS}) - string(REPLACE "gen" "ros" _l ${_l}) - rosbuild_find_ros_package(${_l}) - if(${_l}_PACKAGE_PATH) - set(_cmake_fragment ${${_l}_PACKAGE_PATH}/rosbuild/${_l}.cmake) - if(EXISTS ${_cmake_fragment}) - list(APPEND _cmake_fragments ${_cmake_fragment}) - endif() - endif(${_l}_PACKAGE_PATH) -endforeach(_l) +find_package(catkin COMPONENTS genmsg) +if(genmsg_FOUND) + foreach(_l ${CATKIN_MESSAGE_GENERATORS}) + string(REPLACE "gen" "ros" _l ${_l}) + rosbuild_find_ros_package(${_l}) + if(${_l}_PACKAGE_PATH) + set(_cmake_fragment ${${_l}_PACKAGE_PATH}/rosbuild/${_l}.cmake) + if(EXISTS ${_cmake_fragment}) + list(APPEND _cmake_fragments ${_cmake_fragment}) + endif() + endif(${_l}_PACKAGE_PATH) + endforeach(_l) +endif() # Now include them all foreach(_f ${_cmake_fragments})