[cmake-developers] FindPackageCheckArchLinuxSymlinks branch on stage

Brad King brad.king at kitware.com
Wed Jan 23 19:15:51 EST 2013


On 1/21/2013 4:49 PM, Alexander Neundorf wrote:
> It makes cmake warn if /lib64/ is a symbolic link to /usr/lib/ and a 
> Config.cmake file has been found in one of both (since any relative directory 
> references may be wrong then), see the "General Config.cmake file issue on 
> ArchLinux" thread here from November.

A package configuration file can know the path in which it was
installed under the prefix rather than just the number of path
components below the prefix.  Rather than using "../.." or
stripping path components to get back the original prefix,
we can actually *compare* the suffix part.

Say we install FooConfig.cmake to "<prefix>/lib/cmake/foo".
The file can check if ${CMAKE_CURRENT_LIST_FILE} sits in a
path ending in "/lib/cmake/foo".  If so, then the part before
that is the <prefix>.  If not, then we likely have a symlink.
Try resolving symlinks and then checking whether the path
now ends in "/lib/cmake/foo".  If so, we now have a <prefix>.
If not, then someone has fiddled with the layout since the
installation.

-Brad



More information about the cmake-developers mailing list