[CMake] Relocatable RPM

Gerald Hofmann gerald.hofmann at cosin.eu
Tue Aug 17 10:12:19 EDT 2010


Hi Will,

I found a way to make the RPM relocatable.

This brings some light into rpm relocation: http://www.rpm.org/max-rpm/ch-rpm-reloc.html

The Prefix: tag gives the part of the file names which is replaced when another prefix is specified. You can divert CPACK_RPM_SPEC_MORE_DEFINE from its intended use to add this tag to the spec file.

set( CPACK_RPM_SPEC_MORE_DEFINE "Prefix: /usr" )

The rpm now is relocatable. :-)

However, I did not yet find a way to set the default prefix from cmake, /usr seems to be hard coded. Would be nice if someone feels to add another setting to the generator letting the user set the default prefix and setting the Prefix: tag at the same time to allow relocation.

-Gerry



More information about the CMake mailing list