[CMake] Buggy CPack generator behaviour?

Eric Noulard eric.noulard at gmail.com
Fri Jul 29 02:17:54 EDT 2011


2011/7/29 Bjørn Forsman <bjorn.forsman at gmail.com>:
>>
>> As you guessed this is impossible without backward compat' breakage.
>> e.g. be aware that with "CPACK_SET_DESTDIR" set to ON RPM and DEB
>> behavior changes
>> namely RPM package built with that may not be relocatable.
>
> What do you mean with 'not relocatable'? I didn't see any difference
> in the archive layouts of RPM and DEB when changing CPACK_SET_DESTIR
> from 'not set' to ON.

if you do:

rpm -qpi your.rpm

you'll see a line like:

"Relocations : (not relocatable)"
or
"Relocations : /usr"

When an rpm is relocatable you can do

rpm -i  --prefix=/your/relocation/prefix your.rpm

if the rpm is not relocatable you can't.

> Didn't you say that RPM and DEB generators sets
> CPACK_SET_DESTDIR=ON *itself*?

Yes but not too soon (CPack internal step are indeed multiple) such that
CPack can effectively collect files which are installed purposely with
ABSOLUTE path and
treat them as config file in RPM specification file.

When DESTDIR is set to ON by the user CPack cannot do this work
properly, and spit out a
warning like:

"CPackRPM:Warning: CPACK_SET_DESTDIR is set (=ON) while requesting a
relocatable package (CPACK_RPM_PACKAGE_RELOCATABLE is set): this is
not supported, the package won't be relocatable."

>> You may set(CPACK_SET_DESTDIR ON) only for ArchiveGenerator if you
>> use CPACK_CONFIG_PROJECT_FILE.
>
> Huh?
>
> I have never used CPACK_CONFIG_PROJECT_FILE, I just
> set(CPACK_SET_DESTDIR ON) in CMakeLists.txt and it fixed absolute
> DESTINATION paths for the archive generators. Just like you said in
> the first email. (Yay!)

Because you wanted to go along the fast path and I cannot blame you
but I did Indeed indicate in my firts e-mail:

"If you want to do some specific adjustment depending on the CPack
generator used
you may use a CPACK_PROJECT_CONFIG_FILE see doc here:
http://www.cmake.org/Wiki/CMake:CPackPackageGenerators#Overall_usage_.28common_to_all_generators.29"

Now that the fast path works for you
I thought you may be interested in your CPack config "fine tuning".

Read the link here:
http://www.cmake.org/Wiki/CMake:CPackPackageGenerators#Overall_usage_.28common_to_all_generators.29

and you'll see that you can setup diferent value of CPACK_<whateever>
var depending on the CPack Generator
which is run.

Obviously this is not mandatory in your case because you already get
what you want,
but may be you want to try.

-- 
Erk
Membre de l'April - « promouvoir et défendre le logiciel libre » -
http://www.april.org


More information about the CMake mailing list