From 03bf92ca8704ee24656cb2c0bb31b30cda368c4d Mon Sep 17 00:00:00 2001 From: Dirk Thomas Date: Mon, 11 Jul 2016 10:34:16 -0700 Subject: [PATCH 1/3] fix check if DEPENDS was found --- cmake/catkin_package.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmake/catkin_package.cmake b/cmake/catkin_package.cmake index 8ef6c48a9..a88b62d9c 100644 --- a/cmake/catkin_package.cmake +++ b/cmake/catkin_package.cmake @@ -144,7 +144,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,7 +157,7 @@ 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() list(APPEND PROJECT_DEPENDENCIES_INCLUDE_DIRS ${${depend_name}_INCLUDE_DIRS}) From e78876281f6b566e5fd93baf404a940ed0a3ed35 Mon Sep 17 00:00:00 2001 From: Dirk Thomas Date: Mon, 11 Jul 2016 15:04:46 -0700 Subject: [PATCH 2/3] update doc to clarify importance of case --- cmake/catkin_package.cmake | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cmake/catkin_package.cmake b/cmake/catkin_package.cmake index a88b62d9c..f7c20ebcb 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 From f98e667d399016b205a37ff3a17e6033873ce66d Mon Sep 17 00:00:00 2001 From: Dirk Thomas Date: Mon, 11 Jul 2016 15:05:20 -0700 Subject: [PATCH 3/3] warn if none of the variables of an exported dependency is defined --- cmake/catkin_package.cmake | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cmake/catkin_package.cmake b/cmake/catkin_package.cmake index f7c20ebcb..ee47981a0 100644 --- a/cmake/catkin_package.cmake +++ b/cmake/catkin_package.cmake @@ -162,6 +162,9 @@ function(_catkin_package) 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()