[CMake] post-install script

Eric Noulard eric.noulard at gmail.com
Sat May 23 09:39:55 EDT 2009


2009/5/23 Michael Wild <themiwi at gmail.com>:
> Thanks David
>
> yes, I already did try that (it's the obvious thing to try...).
> Unfortunately the script runs before any of the files get installed.


Hi All,

I think that currently some PRE-INSTALL / POST-INSTALL rules are currently
missing from CMake.
I did evoke the problem with some proposed extension of the CPack RPM generator:

http://www.cmake.org/pipermail/cmake/2009-May/029348.html

As explained in the refered message, the problem is that you
cannot say when INSTALL(CODE/SCRIPT are run).

Most package format at least (RPM, DEB, NSIS) do support pre- and post-
install rules as script.

I may file a feature request with proposed ideas, however do you find it useful?

> On 23. May, 2009, at 13:22, David Cole wrote:
>
>> Put your install( CODE ... ) at the very bottom of the top level
>> CMakeLists.txt file. Then it should run last after all other install
>> steps.
>> Did you already try that and there was a problem with it?

A hack may be to create your own "post_install" target
with add_custom_target.
Then you'll have to

make install && make post_install

in order to make it work.

Would be even easier if we could make custom target depend
on builtin target like:

ADD_DEPENDENCIES(post_install install)

and may be (my usage)

ADD_DEPENDENCIES(install pre_install)

-- 
Erk


More information about the CMake mailing list