/bin before /usr/bin in PATH breaks _IMPORT_PREFIX in generated CMake package config
This happened recently on Arch Linux, apparently using lxdm puts /bin
in front.
Compilers and libraries are detected in /bin
and /lib64
, so far so good.
But a package in /usr/lib/cmake/Foo/FooTargets.cmake
is loaded as /lib64/cmake/Foo/FooTargets.cmake
.
_IMPORT_PREFIX
is then /
resulting in the following error:
Imported target "Foo" includes non-existent path
"/include"
I saw special rules in the code trying to circumvent this using REALPATH
instead of PATH
in get_filename_component
, but i think this only used if the package was installed to the location where it resides in the end, but Arch package install prefixes are not /usr
but some_build_folder/pkg/usr
.
I couldn’t figure out what changed recently to make this a problem. It worked before and the last lxdm release is quite old. This may as well be a recently introduced CMake regression.
repro: env PATH="/bin:$PATH" cmake ..