Do not run cpack at CMake time it is not available.

cpack was used to get the list of available i.e. ACTIVE CPack generators
in the CMake tests suite. This was done in order to get dynamically
available CPack generators like DEB or RPM that may or may not be
available on some platform like MacOSX depending on the fact that
some command are installed or not. We may do that but not during
initial configuration.
The current patch fixes the problem and we may do better in the future
like configuring CPack tests later.
This commit is contained in:
Eric NOULARD 2012-06-28 13:49:49 +02:00
parent 3cb7eefd55
commit 848f2201c5
1 changed files with 12 additions and 22 deletions

View File

@ -717,31 +717,21 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
ENDIF(CTEST_RUN_CPackComponents)
IF(CTEST_RUN_CPackComponentsForAll)
# Analyze 'cpack --help' output for list of available generators:
execute_process(COMMAND ${CMAKE_CPACK_COMMAND} --help
RESULT_VARIABLE result
OUTPUT_VARIABLE stdout
ERROR_VARIABLE stderr)
# Check whether if rpmbuild command is found
# before adding RPM tests
find_program(RPMBUILD_EXECUTABLE NAMES rpmbuild)
if(RPMBUILD_EXECUTABLE)
list(APPEND ACTIVE_CPACK_GENERATORS RPM)
endif(RPMBUILD_EXECUTABLE)
# Check whether if dpkg command is found
# before adding DEB tests
find_program(DPKG_EXECUTABLE NAMES dpkg)
if(DPKG_EXECUTABLE)
list(APPEND ACTIVE_CPACK_GENERATORS DEB)
endif(DPKG_EXECUTABLE)
string(REPLACE ";" "\\;" stdout "${stdout}")
string(REPLACE "\n" "E;" stdout "${stdout}")
set(collecting 0)
set(ACTIVE_CPACK_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 ACTIVE_CPACK_GENERATORS ${gen})
endif()
if(line STREQUAL "Generators")
set(collecting 1)
endif()
endforeach()
# ACTIVE_CPACK_GENERATORS variable
# now contains the list of 'active generators'
set(CPackComponentsForAll_EXTRA_OPTIONS)
set(CPackRun_CPackCommand "-DCPackCommand=${CMAKE_CPACK_COMMAND}")
# set up list of CPack generators