CPack checks if the CMake generator has a preinstall
target and drives it if so. Only Makefile generators have a preinstall
target. It’s meant for re-linking binaries on platforms that support RPATH
/RUNPATH
fields, but using executable formats that CMake doesn’t know how to edit, in order to produce binaries with the install-tree runtime path values. VS generators don’t support targeting any such platforms and so do not have a preinstall
target. The Ninja generator just never supported those platforms, and these days CMake knows how to edit both ELF and XCOFF formats.
If a build is up to date, the preinstall
target should not cause a full rebuild. That’s something to track down locally.