[CMake] CPack option naming and deb generator

Fredrik Hultin fredrik.hultin at gmail.com
Wed Sep 26 06:51:18 EDT 2007


You're describing my problem all over again, if I'm not overlooking
something important.
If I write:

SET(DEBIAN_PACKAGE_ARCHITECTURE "whatever")
INCLUDE(CPack)

in my CMakeList.txt, it will be completly ignored since INCLUDE(CPack)
only transfers variables with the CPACK_-prefix to the
CPackList.cmake. So CPack will never see the
DEBIAN_PACKAGE_ARCHITECTURE-variable. That's why I proposed of naming
it CPACK_DEBIAN_PACKAGE_ARCHITECTURE, since then I can actually use it
at all.

What CPackDeb.cmake says doesn't matter since it will never see
anything but the variables INCLUDE(CPack) has copied to
CPackList.cmake (ie. the ones starting with CPACK_).

Or perhaps I've got it all wrong?

Regards
Fredrik

On 9/26/07, Eric Noulard <eric.noulard at gmail.com> wrote:
> 2007/9/26, Fredrik Hultin <fredrik.hultin at gmail.com>:
> > Hi
> >
> > I've got a question and/or suggestion regarding CPack:
> > How are the generator specific settings supposed to be sent to the generators?
> >
> > If I understand the CPack system correctly you're supposed (or at
> > least you have the option) to write CPack settings in your
> > CMakeLists.txt. This would be achieved by setting up your options with
> > SET(CPACK_option "value") followed by a INCLUDE(CPack). CMake then
> > checks what options are CPack-specific (starts with CPACK_) and places
> > them in the file
> > CPackConfig.cmake. But how about the generator specific options that
> > don't start with CPACK? DEBIAN_PACKAGE_* for example. Wouldn't it be
> > better to name all the options for CPack with the prefix CPACK (like
> > CPACK_DEBIAN_PACKAGE_ARCHITECTURE or perhaps CPACK_DEB_ARCHITECTURE)?
>
> May be but I think the idea was to let CPACK_xxx apply to "generic"
> generator part while other generator (DEB, ZIP, RPM, ...) would
> use  <SPECIFIC_PREFIX>_PACKAGE_<xxxxx>.
>
> None the less you may define your own value
> for "DEBIAN_PACKAGE_ARCHITECTURE" in your CMakeLists.txt
> before INCLUDE(CPack) and your specific value
> should be taken into account.
> Since CPackDeb.cmake  tells:
>
> # Architecture: (mandatory)
> IF(NOT DEBIAN_PACKAGE_ARCHITECTURE)
> # There is no such thing as i686 architecture on debian, you should
> use i386 instead
> # $ dpkg --print-architecture
>   SET(DEBIAN_PACKAGE_ARCHITECTURE i386)
> ENDIF(NOT DEBIAN_PACKAGE_ARCHITECTURE)
>
>
> The same is true for RPM.
> The idea is the following,
>
> if the users did not defined a specific value in its CMakeLists.txt
> then try to define a appropriate one.
>
> >
> > I did a quick modification the deb-generator so that it looked for
> > variables named with the CPACK_DEBIAN_PACKAGE prefix instead and my
> > settings were indeed transferred from CMakeLists.txt to the
> > CPackConfig-file.
>
> The same should be true if you defined:
> DEBIAN_PACKAGE_xxxxx
> vars in your CMakeLists.txt
>
> >
> > I also did a small change to the CPackDeb.cmake file so that it
> > defaults to setting the architecture to the current one using dpkg
> > --print-architecture rather than simply always setting it to "i386"
> > (Since I'm on AMD64 it mislabeled all my generated .deb-packages).
>
> Mathieu (creator for Deb generator) may answer that.
>
> > If you agree you can have the patches, if you don't; please teach me
> > how to do it (ie. selecting DEBIAN_PACKAGE_ARCHITECTURE) the proper
> > way. ;)
>
> Try to set the var in your CMakeLists.txt before INCLUDE(CPack)
>
> SET(DEBIAN_PACKAGE_ARCHITECTURE "whatever")
> INCLUDE(CPack)
> --
> Erk
>


More information about the CMake mailing list