What controls CPack staging location

Background: Our Dakota project integrates Trilinos which uses the TriBITS system for CMake builds. (For better or worse) Dakota manages Trilinos as a sub-package with add_subdirectory. In updating Dakota from Trilinos d2fcc2f to e9cb59b, we can no longer make package.

My CMake-focused question is: What might cause CPack to attempt to stage or make install the binary project into ${CMAKE_INSTALL_PREFIX} instead of a staging area in the build tree as I’m used to? This behavior is causing a fatal error due to default install prefix in /usr/local. We realize this forum can’t solve our odd integration problem, but are just looking for suggestions as to CMake or CPack variables or other settings we might review in our Dakota/Trilinos integration.

CPack uses DESTDIR to “relocate” the installation prior to packaging. There’s no way to control it, but I suspect something is using ${CMAKE_INSTALL_PREFIX} without $ENV{DESTDIR} considerations in the diff between the commits mentioned.

Okay thanks @ben.boeckel; I’ll follow that lead a bit. One surprising thing is that with the Trilinos sub-project update, not just Trilinos targets, but all installed files, even at the parent (Dakota) level are attempting to install into /usr/local at make package time, so some cache variable must be getting set/unset or otherwise modified. I’m also pursuing this with Trilinos: https://github.com/trilinos/Trilinos/issues/7636

Thanks again for the tip @ben.boeckel. Given inspiration to dig deeper, I read about CPACK_SET_DESTDIR, which did change the observed behavior and CPACK_PACKAGING_INSTALL_PREFIX. Those helped me pinpoint the issue.

I was able to track this down to the sub-project overriding CMAKE_INSTALL_PREFIX in a custom INSTALL(SCRIPT …). I think this overwrite during the middle of actual install was getting in the way of DESTDIR or other assumptions about the prefix being set or not. Hence all other sub-projects which followed Trilinos in the install chain were breaking. (To be fair, TriBITS / Trilinos is not intended for use as Dakota does, where other sub-projects follow the final install rules in the TriBITS system.)