[CMake] installing in /etc

Mathieu Malaterre mathieu.malaterre at gmail.com
Tue Apr 1 08:07:06 EDT 2008


Rahhhh nevermind, I just found the solution. Use relative path:

    ADD_EXECUTABLE(gdcmreadahead gdcmreadahead.c)
    INSTALL(TARGETS gdcmreadahead
      DESTINATION usr/sbin
    )
    # package its twin init.d script also:
    INSTALL(PROGRAMS gdcmreadahead
      DESTINATION etc/init.d/
    )

set CMAKE_INSTALL_PREFIX:PATH=/ so that make install still works and
debian package requires still one more trick:

SET(CPACK_PACKAGING_INSTALL_PREFIX "/")

otherwise CPACK_PACKAGING_INSTALL_PREFIX default to /usr

HTH
-Mathieu

On Tue, Apr 1, 2008 at 2:00 PM, Mathieu Malaterre
<mathieu.malaterre at gmail.com> wrote:
> Hi there,
>
>   I do not understand what I need to do to install at absolute file
>  path. Here is what I have right now:
>
>  ...
>     ADD_EXECUTABLE(gdcmreadahead gdcmreadahead.c)
>     INSTALL(TARGETS gdcmreadahead
>       DESTINATION /usr/sbin
>     )
>     # package its twin init.d script also:
>     INSTALL(PROGRAMS gdcmreadahead
>       DESTINATION /etc/init.d/
>     )
>
>  make install works perfectly, but if I try to make package it, i am getting:
>
>
>  [100%] Built target gdcmreadahead
>  Run CPack packaging tool...
>  CPack: Create package using DEB
>  CPack: Install projects
>  CPack: - Run preinstall target for: GDCMREADAHEAD
>  CPack: - Install project: GDCMREADAHEAD
>  CMake Error at cmake_install.cmake:37 (FILE):
>   file Problem setting permissions on file "/usr/sbin/gdcmreadahead"
>
>
>  /usr/bin/strip: could not create temporary file to hold stripped copy
>  of '/usr/sbin/gdcmreadahead'
>  CMake Error at cmake_install.cmake:47 (FILE):
>   file Problem setting permissions on file "/etc/init.d/gdcmreadahead"
>
>
>  CPack Error: Error when generating package: GDCMREADAHEAD
>  make: *** [package] Error 1
>
>
>  full source is at:
>  http://gdcm.svn.sourceforge.net/viewvc/gdcm/Sandbox/gdcmreadahead/
>
>  Thanks,
>  --
>  Mathieu
>



-- 
Mathieu


More information about the CMake mailing list