[Cmake-commits] [cmake-commits] hoffman committed CMakeLists.txt NONE 1.1.2.2 RunCPack.cmake NONE 1.2.2.2

cmake-commits at cmake.org cmake-commits at cmake.org
Wed Oct 28 12:16:16 EDT 2009


Update of /cvsroot/CMake/CMake/Tests/CPackTestAllGenerators
In directory public:/mounts/ram/cvs-serv18987/Tests/CPackTestAllGenerators

Added Files:
      Tag: CMake-2-8
	CMakeLists.txt RunCPack.cmake 
Log Message:
RC 4 merge


--- NEW FILE: CMakeLists.txt ---
cmake_minimum_required(VERSION 2.8)
project(CPackTestAllGenerators)
add_subdirectory(../CTestTest/SmallAndFast SmallAndFast)
install(FILES RunCPack.cmake DESTINATION .)
include(CPack)

--- NEW FILE: RunCPack.cmake ---
if(NOT DEFINED cpack)
  message(FATAL_ERROR "cpack not defined")
endif()

if(NOT DEFINED dir)
  message(FATAL_ERROR "dir not defined")
endif()

# Analyze 'cpack --help' output for list of available generators:
#
execute_process(COMMAND ${cpack} --help
  RESULT_VARIABLE result
  OUTPUT_VARIABLE stdout
  ERROR_VARIABLE stderr
  WORKING_DIRECTORY ${dir})

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}")
    set(generators ${generators} ${gen})
  endif()
  if(line STREQUAL "Generators")
    set(collecting 1)
  endif()
endforeach()

# Call cpack with -G on each available generator. We do not care if this
# succeeds or not. We expect it *not* to succeed if the underlying packaging
# tools are not installed on the system... This test is here simply to add
# coverage for the various cpack generators, even/especially to test ones
# where the tools are not installed.
#
message(STATUS "CTEST_FULL_OUTPUT (Avoid ctest truncation of output)")

message(STATUS "CPack generators='${generators}'")

foreach(g ${generators})
  message(STATUS "Calling cpack -G ${g}...")
  execute_process(COMMAND ${cpack} -G ${g}
    RESULT_VARIABLE result
    OUTPUT_VARIABLE stdout
    ERROR_VARIABLE stderr
    WORKING_DIRECTORY ${dir})
  message(STATUS "result='${result}'")
  message(STATUS "stdout='${stdout}'")
  message(STATUS "stderr='${stderr}'")
  message(STATUS "")
endforeach()



More information about the Cmake-commits mailing list