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

Eric Noulard eric.noulard at gmail.com
Thu May 5 17:20:53 EDT 2011


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 ?



More information about the CMake mailing list