[CMake] Deb Package messages only if deb is available

Dixon, Shane Shane.Dixon at atmel.com
Fri Mar 18 11:17:56 EDT 2011


Eric,

Thank you for the guidance on this.  I'll give it a try.

--
Shane

-----Original Message-----
From: Eric Noulard [mailto:eric.noulard at gmail.com] 
Sent: Thursday, March 17, 2011 12:24 PM
To: Dixon, Shane
Cc: cmake at cmake.org
Subject: Re: [CMake] Deb Package messages only if deb is available

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


More information about the CMake mailing list