[CMake] CMake & RPM problems

Eric Noulard eric.noulard at gmail.com
Sun May 10 06:57:04 EDT 2009

2009/5/9 Alexander Neundorf <a.neundorf-work at gmx.net>:
> On Thursday 07 May 2009, Eric Noulard wrote:
> ...
>> 1) Add more CPACK_RPM_XXX specific var such like:
>>      which may be used to specify the corresponding scripts
>>      that will be embedded in the generated spec file.
> Just a thought, do you think this could in some way with the
> INSTALL(SCRIPT/CODE ... ) command ?
> I guess quite often this already does what is required (at least in KDE it
> also does the update-icon-cache etc. stuff).
> But a problem would be that then cmake would be necessary when installing such
> a RPM :-/

Yes I did think about that too just as you did.
In fact the notion of install-time script may be supported by various
CPack generator (DEB, RPM , NSIS etc...).

It would be a good thing to either:
   - launch INSTALL(SCRIPT/CODE ... ) with an extra cmake dependency
     (the dependency may be added by the generator if it knows that
      there exists some INSTALL(SCRIPT/CODE ... ) rules)

  - translate INSTALL(SCRIPT/CODE ... ) into it's own supported language.
    For example RPM uses bash and I'm pretty sure CMake scripts may
    be translated into shell scripts.
    That would be nicer (no extra dependency) but surely harder to implement.

Another thing I did not look at is "WHEN" INSTALL(SCRIPT/CODE ... )
are launched?
In RPM you can usually chose between pre-install scripts and
post-install scripts
(and their uninstall counterpart).

Currently the INSTALL(SCRIPT/CODE ... ) script is too loose, moreover
as far as I know there aren't any "uninstall rules"...

So currently I think we can get INSTALL(SCRIPT/CODE ... ) to be embedded
into RPM post-install rules, I do have to find where thoses scripts
are generated though.

There will be several remaining issues:
    1) You usually don't want to run "INSTALL(SCRIPT/CODE ... )" when building
         the RPM, however now since CPack basically do install with relocation
         they are.

    2) There is no associated "uninstall" rules, which is just bad
because you may
         leave dangling menu entry and/or icon.

    3) You ger an extra cmake dependency ...

If yes how do packager do for handling that in DEB, RPM ... ?


More information about the CMake mailing list