Re: [CMake] Deb Package messages only if deb is available

2011-03-18 Thread Dixon, Shane
Eric,

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

--
Shane

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

2011/3/17 Dixon, Shane :
> 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__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
___
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake


Re: [CMake] Deb Package messages only if deb is available

2011-03-17 Thread Eric Noulard
2011/3/17 Dixon, Shane :
> 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__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
find_program(CPACK_PROGRAM NAMES cpack)
if (CPACK_PROGRAM)
  # Analyze 'cpack --help' output for list of available generators:
  #
  execute_process(COMMAND ${CPACK_PROGRAM} --help
RESULT_VARIABLE result
OUTPUT_VARIABLE stdout
ERROR_VARIABLE stderr)
  
  string(REPLACE ";" "\\;" stdout "${stdout}")
  string(REPLACE "\n" "E;" stdout "${stdout}")
  
  set(collecting 0)
  set(generators)
  foreach(eline ${stdout})
string(REGEX REPLACE "^(.*)E$" "\\1" line "${eline}")
if(collecting AND NOT line STREQUAL "")
  string(REGEX REPLACE "^  ([^ ]+) += (.*)$" "\\1" gen "${line}")
  string(REGEX REPLACE "^  ([^ ]+) += (.*)$" "\\2" doc "${line}")
  list(APPEND generators ${gen})
endif()
if(line STREQUAL "Generators")
  set(collecting 1)
endif()
  endforeach()  
  set(possiblegen "DEB;NSIS;RPM;STGZ;TBZ2;TGZ;TZ;ZIP;DMG;CygwinBinary;CygwinSource;DragNDrop;Bundle;PackageMaker;OSXX11")
  foreach(gen ${possiblegen})
list(FIND generators "${gen}" IDX)
if(IDX EQUAL "-1")
  set(CPACK_${gen}_FOUND FALSE)
else()
  set(CPACK_${gen}_FOUND TRUE)
endif()
  endforeach()
endif(CPACK_PROGRAM)___
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

[CMake] Deb Package messages only if deb is available

2011-03-17 Thread Dixon, Shane
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)

 

that I can use to determine if the deb package builder will be used?  Should I 
scan CPACK_GENERATORS for 'DEB"?  What's the best way to do this?

 

---

Shane Dixon

Linux Engineer / Atmel Corporation

Tel: (+1)(719)540-1123

shane.di...@atmel.com / www.atmel.com

 

The information contained in this email message may be privileged, confidential 
and/or protected from unauthorized disclosure. If you are not the intended 
recipient, any dissemination, distribution or copying is strictly prohibited. 
Please immediately notify the sender by reply if you received this email in 
error. Thank you for your cooperation.

 

___
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake