Skip to content

CPack: Make STGZ handle install prefixes better

sidju requested to merge sidju/cmake:STGZ-support-install-location into master

STGZ now uses the "CPACK_STGZ_INCLUDE_SUBDIR" (new feature) setting given by CPACK as a default on wether or not to include subdir.

Some checks have been made so that STGZ packages use CPACK_PACKAGING_INSTALL_PREFIX if defined, as documentation suggests it should at https://cmake.org/cmake/help/latest/variable/CPACK_PACKAGING_INSTALL_PREFIX.html

(It would probably be advantageous to mention CPACK_PACKAGING_INSTALL_PREFIX in the cpack documentation at https://cmake.org/cmake/help/latest/module/CPack.html, but I don't know where in the repo your documentation resides.)

The setting is overridden by any arguments given upon execution, enabling installation in any location chosen by user if need be.

A potential problem is that the configure_file mechanic doesn't support flow control, so the resulting script has a if clause that always returns the same.

In combination these changes allow the creation of a package that installs in the location the packager intended by default.

Topic-rename: cpack-STGZ-support-install-location

Edited by Brad King

Merge request reports