MantisBT - CMake
View Issue Details
0010339CMakeCPackpublic2010-02-26 09:222010-12-14 18:50
Marcelo Fontenele S Santos 
Eric NOULARD 
normalminoralways
closedwon't fix 
CMake-2-8 
CMake-2-8 
0010339: RPM generator does not understand path in destination
According to the documentation, the DESTINATION parameter of the INSTALL command will use ${CMAKE_INSTALL_PREFIX} as a prefix if no absolute path is give.

So

INSTALL( FILES "my.sh" DESTINATION ${CMAKE_INSTALL_PREFIX}/bin )

and

INSTALL( FILES "my.sh" DESTINATION bin )

means the same thing.

The problem is that the RPM generator for CPack does not work with the first option. It does not put my.sh in the generated rpm.
Example CMakeLists.txt that does not work (removing ${CMAKE_INSTALL_PREFIX}/ it does):

cmake_minimum_required(VERSION 2.6)

SET(CPACK_GENERATOR "RPM")
SET(CPACK_PACKAGE_VERSION_MAJOR 1)
SET(CPACK_PACKAGE_VERSION_MINOR 0)
SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "a test")
SET(CPACK_PACKAGE_CONTACT "test@example.com")
SET(CPACK_PACKAGE_VENDOR "ACME Inc.")
SET(CPACK_PACKAGE_FILE_NAME "test")

INSTALL( FILES "test.sh" DESTINATION ${CMAKE_INSTALL_PREFIX}/bin )

INCLUDE(CPack)
No tags attached.
related to 0007000closed Eric NOULARD CPack RPM generator should always "CPACK_SET_DESTDIR" 
Issue History
2010-02-26 09:22Marcelo Fontenele S SantosNew Issue
2010-02-26 13:22Bill HoffmanNote Added: 0019648
2010-02-26 13:22Bill HoffmanStatusnew => assigned
2010-02-26 13:22Bill HoffmanAssigned To => Bill Hoffman
2010-07-06 02:37Eric NOULARDAssigned ToBill Hoffman => Eric NOULARD
2010-07-06 02:38Eric NOULARDRelationship addedrelated to 0007000
2010-07-09 18:38Eric NOULARDNote Added: 0021342
2010-07-09 18:40Eric NOULARDNote Added: 0021343
2010-07-09 18:40Eric NOULARDStatusassigned => resolved
2010-07-09 18:40Eric NOULARDFixed in Version => CMake-2-8
2010-07-09 18:40Eric NOULARDResolutionopen => won't fix
2010-12-14 18:50David ColeNote Added: 0024102
2010-12-14 18:50David ColeStatusresolved => closed

Notes
(0019648)
Bill Hoffman   
2010-02-26 13:22   
You should not do this:
INSTALL( FILES "test.sh" DESTINATION ${CMAKE_INSTALL_PREFIX}/bin )

But, if you must, then use this:

SET(CPACK_SET_DESTDIR YES)
(0021342)
Eric NOULARD   
2010-07-09 18:38   
Installing file with absolute path name like
"${CMAKE_INSTALL_PREFIX}/bin" is not a good idea because it prevent
you from building relocatable package, moreover as Bill said, you'll need
to SET(CPACK_SET_DESTDIR YES).

CPack is not using CMAKE_INSTALL_PREFIX but CPACK_PACKAGING_INSTALL_PREFIX.
If you set(CPACK_PACKAGING_INSTALL_PREFIX /your/prefix)

INSTALL( FILES "my.sh" DESTINATION bin)

will build a package which contains:
/your/prefix/bin/my.sh

now if you do not specify "CPACK_PACKAGING_INSTALL_PREFIX" the default
value for CPackRPM is to use "/usr".

if you SET(CPACK_SET_DESTDIR YES) then CMAKE_INSTALL_PREFIX will ne used
and your package will contain
${CMAKE_INSTALL_PREFIX}/bin/my.sh
(0021343)
Eric NOULARD   
2010-07-09 18:40   
This issue is not a real one.

1) there is a misunderstanding of CPack behavior
2) there is an already know problem concerning absolute path file
(0024102)
David Cole   
2010-12-14 18:50   
Closing bugs that have been resolved for more than 3 months without any further updates.