fix check if DEPENDS was found#813
Conversation
|
+1 Kinetic only. This could potentially break a lot of packages and for most older packages it's at least working to some extent. And it doesn't force a fork since the correct code is fully compatible. |
|
I do not think that this patch would solve the problem of https://github.com/ros-simulation/gazebo_ros_pkgs/pull/473/files/a9ac9b93699e72e2d83765b01bed33b467845a01#r70289189, but maybe I am wrong and I have not tested it. The thing is that cmake "searches for a file called As a consequence, package names listed in [1] https://cmake.org/cmake/help/v3.0/command/find_package.html |
|
@meyerj I don't think your expectation is accurate. The case of the package name passed to The case of the passed name only affects which config files are being considered. catkin packages always generate config files with the first naming. Simply because it make it very clear that the case you use for the This patch is not intending to solve the problem in the CMake file of the |
|
+1 for Kinetic. @meyerj I don't think this is intended to solve the problem there, just to fix the error condition that should have caught the problem at a more reasonable place.
As I read the documentation, that only happens when you use the |
I understood that this patch was not supposed to fix gazebo_plugins, but it would also not trigger the
The cited phrase of the cmake documentation is not only for the
cmake sets the I created a quick test to verify this. The result (Ubuntu 14.04 with cmake 2.8.12.2) is: -- The C compiler identification is GNU 4.8.4
-- The CXX compiler identification is GNU 4.8.4
-- Check for working C compiler: /usr/lib/ccache/cc
-- Check for working C compiler: /usr/lib/ccache/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/lib/ccache/c++
-- Check for working CXX compiler: /usr/lib/ccache/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- [CMakeLists.txt] Calling `find_package(FOO REQUIRED)`
-- [foo-config.cmake] Found package 'foo' in '/home/johannes/catkin-813-test/cmake':
-- [foo-config.cmake] - FOO_INCLUDE_DIRS=/path/to/package/foo/include
-- [CMakeLists.txt] After `find_package(FOO REQUIRED)`:
-- [CMakeLists.txt] - FOO_FOUND=1
-- [CMakeLists.txt] - FOO_DIR=/home/johannes/catkin-813-test/cmake
-- [CMakeLists.txt] - FOO_CONFIG=/home/johannes/catkin-813-test/cmake/foo-config.cmake
-- [CMakeLists.txt] - FOO_CONSIDERED_CONFIGS=/home/johannes/catkin-813-test/cmake/foo-config.cmake
-- [CMakeLists.txt] - FOO_INCLUDE_DIRS=/path/to/package/foo/include
-- [CMakeLists.txt] - foo_FOUND is not defined.
-- [CMakeLists.txt] - foo_DIR is not defined.
-- [CMakeLists.txt] - foo_CONFIG is not defined.
-- [CMakeLists.txt] - foo_CONSIDERED_CONFIGS is not defined.
-- [CMakeLists.txt] - foo_INCLUDE_DIRS is not defined.
--
-- [CMakeLists.txt] Calling `find_package(foo REQUIRED)`
-- [foo-config.cmake] Found package 'foo' in '/home/johannes/catkin-813-test/cmake':
-- [foo-config.cmake] - FOO_INCLUDE_DIRS=/path/to/package/foo/include
-- [CMakeLists.txt] After `find_package(foo REQUIRED)`:
-- [CMakeLists.txt] - FOO_FOUND is not defined.
-- [CMakeLists.txt] - FOO_DIR=/home/johannes/catkin-813-test/cmake
-- [CMakeLists.txt] - FOO_CONFIG is not defined.
-- [CMakeLists.txt] - FOO_CONSIDERED_CONFIGS is not defined.
-- [CMakeLists.txt] - FOO_INCLUDE_DIRS=/path/to/package/foo/include
-- [CMakeLists.txt] - foo_FOUND=1
-- [CMakeLists.txt] - foo_DIR=/home/johannes/catkin-813-test/cmake
-- [CMakeLists.txt] - foo_CONFIG=/home/johannes/catkin-813-test/cmake/foo-config.cmake
-- [CMakeLists.txt] - foo_CONSIDERED_CONFIGS=/home/johannes/catkin-813-test/cmake/foo-config.cmake
-- [CMakeLists.txt] - foo_INCLUDE_DIRS is not defined.
--
-- Configuring done
-- Generating done
-- Build files have been written to: /home/johannes/catkin-813-testAs you can see the |
|
As you point out we have to differentiate which variables we are talking about. Since the function To avoid the inconsistency of having some variables have one case and some other a different case catkin packages us the case sensitive naming scheme to ensure consistency. For packages which use inconsistent case (which includes allowing to find the package with different cases) there is no way to derive the variable names based on the argument (since they might use any case). I don't think catkin can address this inconsistency. |
In my opinion, the use of the term name (which I bolded in my quote) is ambiguous in the documentation. Based on your example, I think you're right it does look at the given @dirk-thomas I agree with @meyerj that this will not cause the error to be thrown for the scenario in the linked ticket. As he said, @meyerj acknowledging what you're pointing out about the this pr not causing the error to be raised for |
|
Thanks Dirk, this is exactly what I imagined as a possible patch in the original comment. Your first commit, df54f49, is useless because the added expression |
|
I don't think the first part of the condition is redundant. Please see the following example. The second condition is false while the first one is true: |
Your counter-example is correct. Apparently there is a difference between cmake_minimum_required(VERSION 2.8)
project(foo)
if(NOT DEFINED bar_FOUND)
message("`NOT DEFINED bar_FOUND` is true")
else()
message("`NOT DEFINED bar_FOUND` is false")
endif()
if(${bar_FOUND})
message("`\${bar_FOUND}` is true")
else()
message("`\${bar_FOUND}` is false")
endif()
if(bar_FOUND)
message("`bar_FOUND` is true")
else()
message("`bar_FOUND` is false")
endif()
if(NOT ${bar_FOUND})
message("`NOT \${bar_FOUND}` is true")
else()
message("`NOT \${bar_FOUND}` is false")
endif()
if(NOT bar_FOUND)
message("`NOT bar_FOUND` is true")
else()
message("`NOT bar_FOUND` is false")
endif()outputs So the check in catkin_package() could be simply written as if(NOT ${depend_name}_FOUND) |
822fd8f to
f98e667
Compare
|
Good point. That is definitely easier to read: 03bf92c |
since ros/catkin#813 catkin checks that the dependency was actually found.
This will break any package which declares something as
DEPENDSwhich hasn't beenfind-package-ed before. E.g. https://github.com/ros-simulation/gazebo_ros_pkgs/pull/473/files/a9ac9b93699e72e2d83765b01bed33b467845a01#r70289189Currently due to the wrong condition no error message is printed but the intended export is also not happening since the passed name is not valid.
I would suggest to only release this into Kinetic and let the maintainers of packages which start failing to build because of this fix their CMake files. @ros/ros_team What do you think?