[cmake-developers] [CMake 0011944]: CPackDeb: Support dependencies between components/Debian packages

Domen Vrankar domen.vrankar at gmail.com
Mon Apr 20 13:19:43 EDT 2015


> Hi,
>
> If I am not mistaken, this does not work in the current state of the
> cmCpackDebGenerator.cxx (I tried of course). I wanted to know by which
> *magic* this could work, and also why you are suggesting me this, which lead
> me to this:
>
> - CPackRPM: all the RPM creation is driven by the CPackRPM.cmake itself
> - CPackDEB: part of package configuration is sent from the .cmake back to
> the cmCPackDebGenerator.cxx, and some internal functions in C++ are creating
> the package definition.

Sorry about that... I completely forgot about that difference.

> The workflow is not the same, so if I scope all the variables in a function
> in the .cmake file, I have no way to get these variables back in the .cxx
> file. For the RPM package, this is fine since at the end of the
> CPackRPM.cmake call, the package is created.
>
> My guess is that I do not have the choice: I have to do some set/unset to
> avoid inter-component troubleshooting.
>
> Any suggestion more than welcome.

The thing is that inside CPack you can only access variables from
project CMakeLists.txt that are prefixed by CPACK_ so CPackDEB can
even see CPACK_RPM* variable settings.

Variables also can't be set across different CPack generators e.g. if
I set a variable inside CPackRPM generator and then run both RPM and
DEB generator at the same time the value won't be present in CPackDEB
generator.

On the other hand variables that are set in CPackDEB.cmake for one
component are later visible in the other - they don't get reread from
CMakeLists.txt for every pass. So setting variables inside
CPackDEB.cmake is a bit dangerous.

For that reason every CPackDEB variable that is used in
cmCPackDebGenerator::createDeb() will have to be renamed for e.g. from
CPACK_DEBIAN_PACKAGE_NAME to something like _CPACK_DEBIAN_PACKAGE_NAME
and in CPackDEB.cmake those variables would have to be set(...
PARENT_SCOPE) from let's say cpack_deb_generate_package() function for
every pass. That way you contain variable setting and prevent future
accidental overwrites.

I'll write a patch for that today and push it to next. I'll also add
link here so that you'll be able to use it before it gets to master.

Regards,
Domen


More information about the cmake-developers mailing list