diff --git a/cmake/catkin_package.cmake b/cmake/catkin_package.cmake index 8ef6c48a9..ee47981a0 100644 --- a/cmake/catkin_package.cmake +++ b/cmake/catkin_package.cmake @@ -31,7 +31,9 @@ # :param DEPENDS: a list of CMake projects which this project depends # on. Since they might not be *find_packagable* or lack a pkg-config # file their ``INCLUDE_DIRS`` and ``LIBRARIES`` are passed directly. -# This requires that it has been ``find_package``\ -ed before. +# This requires that it has been ``find_package``\ -ed before and all +# variables (``_FOUND``, ``_INCLUDE_DIRS``, etc.) have the +# same case as this argument. # :type DEPENDS: list of strings # :param CFG_EXTRAS: a CMake file containing extra stuff that should # be accessible to users of this package after @@ -144,7 +146,7 @@ function(_catkin_package) endif() if("${second_item}" STREQUAL "COMPONENTS") list(GET depend_list 0 depend_name) - if(NOT ${${depend_name}_FOUND}) + if(NOT ${depend_name}_FOUND) message(FATAL_ERROR "catkin_package() DEPENDS on '${depend}' which must be find_package()-ed before") endif() message(WARNING "catkin_package() DEPENDS on '${depend}' which is deprecated. find_package() it before and only DEPENDS on '${depend_name}' instead") @@ -157,9 +159,12 @@ function(_catkin_package) #message(WARNING "catkin_package() DEPENDS on catkin package '${depend_name}' which is deprecated. Use CATKIN_DEPENDS for catkin packages instead.") list(APPEND _PROJECT_CATKIN_DEPENDS ${depend_name}) else() - if(NOT ${${depend_name}_FOUND}) + if(NOT ${depend_name}_FOUND) message(FATAL_ERROR "catkin_package() DEPENDS on '${depend_name}' which must be find_package()-ed before. If it is a catkin package it can be declared as CATKIN_DEPENDS instead without find_package()-ing it.") endif() + if(NOT DEFINED ${depend_name}_INCLUDE_DIRS AND NOT DEFINED ${depend_name}_LIBRARIES) + message(WARNING "catkin_package() DEPENDS on '${depend_name}' but neither '${depend_name}_INCLUDE_DIRS' nor '${depend_name}_LIBRARIES' is defined.") + endif() list(APPEND PROJECT_DEPENDENCIES_INCLUDE_DIRS ${${depend_name}_INCLUDE_DIRS}) list(APPEND PROJECT_DEPENDENCIES_LIBRARIES ${${depend_name}_LIBRARIES}) endif()