~ubuntu-branches/ubuntu/lucid/cmake/lucid

« back to all changes in this revision

Viewing changes to Tests/CPackTestAllGenerators/RunCPack.cmake

  • Committer: Bazaar Package Importer
  • Author(s): Artur Rona
  • Date: 2009-12-16 11:11:54 UTC
  • mfrom: (3.1.9 sid)
  • Revision ID: james.westby@ubuntu.com-20091216111154-6accvv6yq86h2hkc
Tags: 2.8.0-5ubuntu1
* Merge from debian testing (LP: #497349). Remaining changes:
  - Keep the Replaces: on cmake-data to cover the Kubuntu version from
    Jaunty in case someone decides to do an (unsupported) Jaunty->Lucid
    upgrade.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
if(NOT DEFINED cpack)
 
2
  message(FATAL_ERROR "cpack not defined")
 
3
endif()
 
4
 
 
5
if(NOT DEFINED dir)
 
6
  message(FATAL_ERROR "dir not defined")
 
7
endif()
 
8
 
 
9
# Analyze 'cpack --help' output for list of available generators:
 
10
#
 
11
execute_process(COMMAND ${cpack} --help
 
12
  RESULT_VARIABLE result
 
13
  OUTPUT_VARIABLE stdout
 
14
  ERROR_VARIABLE stderr
 
15
  WORKING_DIRECTORY ${dir})
 
16
 
 
17
string(REPLACE ";" "\\;" stdout "${stdout}")
 
18
string(REPLACE "\n" "E;" stdout "${stdout}")
 
19
 
 
20
set(collecting 0)
 
21
set(generators)
 
22
foreach(eline ${stdout})
 
23
  string(REGEX REPLACE "^(.*)E$" "\\1" line "${eline}")
 
24
  if(collecting AND NOT line STREQUAL "")
 
25
    string(REGEX REPLACE "^  ([^ ]+) += (.*)$" "\\1" gen "${line}")
 
26
    string(REGEX REPLACE "^  ([^ ]+) += (.*)$" "\\2" doc "${line}")
 
27
    set(generators ${generators} ${gen})
 
28
  endif()
 
29
  if(line STREQUAL "Generators")
 
30
    set(collecting 1)
 
31
  endif()
 
32
endforeach()
 
33
 
 
34
# Call cpack with -G on each available generator. We do not care if this
 
35
# succeeds or not. We expect it *not* to succeed if the underlying packaging
 
36
# tools are not installed on the system... This test is here simply to add
 
37
# coverage for the various cpack generators, even/especially to test ones
 
38
# where the tools are not installed.
 
39
#
 
40
message(STATUS "CTEST_FULL_OUTPUT (Avoid ctest truncation of output)")
 
41
 
 
42
message(STATUS "CPack generators='${generators}'")
 
43
 
 
44
foreach(g ${generators})
 
45
  message(STATUS "Calling cpack -G ${g}...")
 
46
  execute_process(COMMAND ${cpack} -G ${g}
 
47
    RESULT_VARIABLE result
 
48
    OUTPUT_VARIABLE stdout
 
49
    ERROR_VARIABLE stderr
 
50
    WORKING_DIRECTORY ${dir})
 
51
  message(STATUS "result='${result}'")
 
52
  message(STATUS "stdout='${stdout}'")
 
53
  message(STATUS "stderr='${stderr}'")
 
54
  message(STATUS "")
 
55
endforeach()