[CMake] RPM packages and install(SCRIPT...)

Judicaël Bedouet j.bedouet at infonie.fr
Mon May 9 04:37:37 EDT 2011


Hi Eric,

> You should use:
> execute_process(
>  COMMAND ${CMAKE_COMMAND} -E create_symlink file link
>  WORKING_DIRECTORY $ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/share/TestLink
>  )

Thanks, it works fine.

> so the INSTALL(SCRIPT ...) should work for all of them as soon as symlinks
are supported (which may not be the case on Windows).

Indeed, I have read a lot of CMake posts about create_symlink under Windows,
but for the moment, our software is only installed under Linux, so it should
be sufficient but I would better put a warning in the script...

Thanks,

J. Bedouet



2011/5/5 Eric Noulard <eric.noulard at gmail.com>

> 2011/5/5 Judicaël Bedouet <j.bedouet at infonie.fr>:
> > Hi,
>
> Hi Judicaël,
>
> > I use install(SCRIPT...) to make links during installation. It works with
> a
> > normal installation (make install) but the script seems not to be
> executed
> > by CPack or CPack RPM (I have not tested other generators). I could solve
> > the problem by making a specific RPM spec but the post-install code would
> be
> > duplicated in two files.
> >
> > Is it intended that CPack doesn't execute install(SCRIPT...) ?
>
> In fact it does but you did not see what happened.
> Your install script:
>
> execute_process(
>  COMMAND ${CMAKE_COMMAND} -E create_symlink file link
>  WORKING_DIRECTORY ${CMAKE_INSTALL_PREFIX}/share/TestLink
>  )
>
> does not support DESTDIR, which is used by CPack in order to install
> locally
> (inside build/_CPack_Packages ... )
> before packaging.
>
> You should use:
> execute_process(
>  COMMAND ${CMAKE_COMMAND} -E create_symlink file link
>  WORKING_DIRECTORY $ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/share/TestLink
>  )
>
> and this should work in both cases (make install and CPack run).
>
> > Is there a better way to create links between files ?
>
> From a "pure" RPM perspective you should write an RPM post install script
> and
> set(CPACK_RPM_POST_INSTALL_SCRIPT_FILE "your-script.sh")
> now I understand you want to have a single script for all package format
> so the INSTALL(SCRIPT ...) should work for all of them as soon as
> symlinks are supported (which may not be the case on Windows).
>
>
> --
> Erk
> Membre de l'April - « promouvoir et défendre le logiciel libre » -
> http://www.april.org
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20110509/97d811c5/attachment.htm>


More information about the CMake mailing list