[CMake] [CPack] post install scripts

Domagoj Saric domagoj.saric at littleendian.com
Fri Jul 22 04:18:28 EDT 2011


On 21.7.2011. 13:49, David Cole wrote:
>     Apologies for nagging but Google searches about CMake, CPack and symlinks
>     show that is not a rare problem/question..is there no comment/help on this
>     from the CMake devs?
>
>
> Just busy, that's all...

Ok, sorry...It just seemed to me that nobody cared about this considering that 
the list does otherwise have noticeable traffic...


> install(CODE) and install(SCRIPT) code is run at "make install" time. By
> default, CPack does a "make install" to an intermediate location in the build
> tree (underneath _CPack_Packages in your build tree) as part of building the
> final installer.

So basically install( CODE/SCRIPT ) have any influence on the CPack generated 
installer only if they alter the contents of the directories and/or files that 
go into the installer (as specified by other install() CMake commands)?


> I don't know about the CPack post script stuff, or the OS X version differences
> you're talking about. I'll have to investigate / take a look later, but not sure
> I'll have the time for it this week. If you can give me easy-to-reproduce steps,
> that might help.

As far as the CPack post install scripts go, this is easy to reproduce:
a)
  set( CPACK_POSTFLIGHT_SCRIPT "myscript.sh" )
  set( CPACK_OSX_PACKAGE_VERSION 10.5 )
b)
  set( CPACK_POSTFLIGHT_SCRIPT "myscript.sh" )

For (a) the script does not get included in the installer at all, for (b) it 
does get included but it does not get executed.

You can also easily see why this is so if you fire up PackageMaker, create a 
dummy project and then in the installer properties change the minimum target 
version to 10.5 and then notice how for all components all pre/postflight script 
options have gone and only preinstall and postinstall are left...

It is also not specified in the documentation (or I did not find it) does/should 
CPack automatically include/copy "myscript.sh" into the installer/package 
(whatever the generator used) or does it simply make a 'reference' of some sort 
and the user must somehow manually ensure that the script (the actual file) gets 
included in the installer?

These post install script problems however are secondary for me, as my main 
problem (that I tried to solve with scripts) is how to create symlinks with 
CPack. If there is any other way that works I would be more than grateful if 
someone could share it with me ;)

In this specific case of mine relative symlinks would work good enough, and 
those I can generate manually or at CMake time so if there could be a way to add 
symlinks as symlinks (not as actual files they point to) to the CPack installer 
this specific problem of mine would probably be solved.


In any case, the need for proper portable post install scripting and symlinks 
support in CPack is definitely needed. AFAICT, CMake still supports symlinks 
only on *NIXes while they also exist on Windows since Win2k times...


Thanks in advance ;)


-- 
"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