[CMake] Deb Package messages only if deb is available

Eric Noulard eric.noulard at gmail.com
Thu Mar 17 14:24:28 EDT 2011


2011/3/17 Dixon, Shane <Shane.Dixon at atmel.com>:
> I want to add some messages at the end of cmake that display all the
> DEB-related variables and what they’re set to.  I’d prefer to now shows
> these when building on windows where DEB isn’t available.  Is there
> something like
>
>
>
>   If(DEBIAN_FOUND)

This is not currently possible because
[un]fortunately CMake is not aware of CPack generator existence :-]

> that I can use to determine if the deb package builder will be used?  Should
> I scan CPACK_GENERATORS for ‘DEB”?

You cannot scan that either, because this var is set to a default value by CMake
and it may be overwritten by the user.

> What’s the best way to do this?

You can try the attached cmake script which launch "cpack --help" and collect
available generators from CPack itself, if it is found then

CPACK_<GEN>_FOUND is set to true.

try
include(AvailableCPackGenerators.cmake)

then
if (CPACK_DEB_FOUND)
or
if (CPACK_TGZ_FOUND)

etc...
should.

If you find the feature is worth to be included in CMake mainstream
file a feature request and attach the file (or a modified version if
you can do it in a better way).

-- 
Erk
Membre de l'April - « promouvoir et défendre le logiciel libre » -
http://www.april.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: AvailableCPackGenerators.cmake
Type: text/x-cmake
Size: 1149 bytes
Desc: not available
URL: <http://www.cmake.org/pipermail/cmake/attachments/20110317/5a804c74/attachment.bin>


More information about the CMake mailing list