[CMake] [CPack] post install scripts

Domagoj Saric domagoj.saric at littleendian.com
Tue Jul 19 07:41:54 EDT 2011


Hi, I'm using CMake 2.8.5 and OS X 10.6.8. I'm trying to create an multi 
component installer with CPack and PackageMaker (an .mpkg) that would create a 
symlink as a post installation step. Simplified: the installer installs 
directories A and B and then I want to add a symlink in directory B that points 
to a file in directory A. I cannot just add the symlink in the installer because 
the user is allowed to change the target root installation directory (i.e. root 
of the system volume or the user directory) so I have to create the symlink 
at/after installation time in order to make it point to the correct location.

Before even being able to test the post installation script functionality I ran 
into the following problems:

  - CPack (with PackageMaker) uses CPACK_PREFLIGHT_SCRIPT, 
CPACK_POSTFLIGHT_SCRIPT and CPACK_POSTUPGRADE_SCRIPT which are not available 
when targeting OS X 10.5 or later, only preinstall and postinstall seem to 
available then. The result is that no script is added when set( 
CPACK_OSX_PACKAGE_VERSION 10.5 )...

  - without set( CPACK_OSX_PACKAGE_VERSION 10.5 ) (defaults to 10.3) specified 
scripts are added to the root Resource folder of the installer (although 
stripped of the .sh extension and renamed to simply preflight, postflight and 
postupgrade) but they do not get executed. The "Scripts directory" (as seen when 
the resulting mpkg is opened in PackageMaker) is also set for the individual 
components but individual script entries are left blank.


ps. how do install( CODE ) and install( SCRIPT ) relate to CPack? Do they get 
included in the generated installer in some way?


-- 
"What Huxley teaches is that in the age of advanced technology, spiritual
devastation is more likely to come from an enemy with a smiling face than
from one whose countenance exudes suspicion and hate."
Neil Postman


More information about the CMake mailing list