Description
If a CMake-findable package exists on the system (for example, there is a FindPACKAGENAME.cmake
in /usr/share/cmake-2.8/Modules
), and a Catkin package with the same name exists, find_package(catkin REQUIRED COMPONENTS PACKAGENAME)
will find the system package, not the Catkin package.
An example of when the problem occurs:
- You have a package installed to the system that provides a CMake find package file (for example,
Findosg.cmake
forOpenSceneGraph
) - You have a Catkin package named
osg
- You have a Catkin package that depends on
osg
viafind_package(catkin REQUIRED COMPONENTS osg)
In this case, the system package OpenSceneGraph
will be found, rather than your Catkin package osg
.
In contrast, the problem does not appear to occur in the comparable case of local Catkin package that shadows a system Catkin package. In this case, Catkin reorders the packages to ensure that the shadow package is processed before the dependant package. This would be much more reasonable behavior in the case of this bug.
In most cases, having a Catkin package with the same name as a system package should be avoided, but given the long list of system CMake files, some of which (like Findosg.cmake, which is deprecated in favor of FindOpenSceneGraph.cmake, but is still shipped for compatibility) have different names than their respective packages, it is fairly easy to accidentally shadow a system package.