GNUInstallDirs: CMAKE_INSTALL_FULL_* variables do not respect CMAKE_STAGING_PREFIX
We are building an SDK based on Yocto, and we would like that apps compiled with the SDK would normally be installed under
$SDKSYSROOT/usr, unless the user has explicitly overriden the
The solution we have implemented is to define
CMAKE_STAGING_PREFIX to be our
$SDKSYSROOT/usr, and this works fine when the app's cmake script is only using
CMAKE_INSTALL_LIBDIR and so: all files are installed in their proper place somewhere under the SDK sysroot.
However, if the app's cmake script uses
CMAKE_INSTALL_FULL_LIBDIR (for example, but this applies to any
_FULL_ variable) then this breaks, because such paths always start with
I've debugged the issue, and I would say that the bug is in
Modules/GNUInstallDirs.cmake, which concatenates the
CMAKE_INSTALL_PREFIX without first checking if
CMAKE_STAGING_PREFIX is set.