[cmake-developers] General Config.cmake file issue on ArchLinux

Stephen Kelly steveire at gmail.com
Sun Nov 18 11:56:29 EST 2012


Alexander Neundorf wrote:

> On Saturday 17 November 2012, Alexander Neundorf wrote:
>> Hi,
>> 
>> maybe I am missing something, but here we go:
>> 
>> on 64bit ArchLinux installations, /lib64/ is a symlink to /usr/lib/.
>> /bin/ and /usr/bin/ are normal directories, no symlinks.
>> 
>> Now if a Config.cmake files is installed into /usr/lib/foo/, and
>> references other files of its installations using relative paths from its
>> own location to e.g. /usr/bin/ (../../bin/ ), there is breakage.
>> 
>> CMake finds FooConfig.cmake in /lib64/foo/FooConfig.cmake (which it seems
>> to search before /usr/lib). Then it goes ../../bin/, but doesn't end up
>> in /usr/bin/, where e.g. some executable is located, but instead it goes
>> to /lib64/foo/../../bin/, which is /bin/, but the expected executable is
>> not there, and so the FooConfig.cmake file fails.
>> 
>> I'm not sure what the right way to deal with this is.
>> Is this only on ArchLinux ?
>> If so, maybe the best thing to do is to tell the ArchLinux developers to
>> set up their symlinks in a different way ?
>> Having e.g. /usr/lib64/ point to /usr/lib/ would make it work I think.
>> Or if /lib64/ points to /usr/lib/, then maybe /bin/ should also point to
>> /usr/bin/.
>> Other ideas ?
>> Or can CMake be tweaked to handle this ?
> 

I thought about a similar issue recently, namely that packagers packaging 
Qt5 might move the cmake config files to a different location. (eg from 
lib/cmake/ to share/) which would break the files (as they have relative 
paths too).

I think that if packagers are moving files around like that, then they'll 
need to patch the config files too. They don't currently know that, so the 
solution would be to ship a README.PACKAGERS file which tells them that they 
need to make sure that cmake config files' relative paths are able to find 
what they refer to.

This issue seems to be somewhat similar, in that a good description in a 
README.PACKAGERS file may have also alerted packagers to check that the 
relative paths are correct.

CMake docs for find_package don't say anything about finding things in 
lib64/ dirs, and it doesn't seem to say anything about which prefixes are 
searched and in what order, so I'm not sure why it picks the config file 
which it eventually finds. Do we know if the people hitting this have set 
CMAKE_PREFIX_PATH themselves? The docs for find_package should get some 
mention of symlinks and how/whether they are followed (unless that is 
already elsewhere).

A generic solution would be nice for this too, but I think it makes sense to 
find out how much of it is just a documentation issue first.

Thanks,

Steve.





More information about the cmake-developers mailing list