CMAKE_STAGING_PREFIX and install()
CMAKE_STAGING_PREFIX
should take precedence over CMAKE_INSTALL_PREFIX
when set.
This impacts several aspects of the build process. It should also impact install(...)
commands, but it does not.
Background: I want to build a 3rd party CMake project unmodified for another machine (cross-compiling to be precise). I'm setting
-DCMAKE_INSTALL_PREFIX=/usr
-DCMAKE_STAGING_PREFIX=/home/user/cjson/stage
but the install
target, tries to write files to CMAKE_INSTALL_PREFIX
, rather than the expected CMAKE_STAGING_PREFIX
.
Furthermore, install(...)
may rely on GNUInstallDirs
for different file types. According #17340, this might contribute to the issue.