diff options
author | Eric NOULARD <eric.noulard@gmail.com> | 2012-03-30 15:07:06 (GMT) |
---|---|---|
committer | Eric NOULARD <eric.noulard@gmail.com> | 2012-05-20 20:04:32 (GMT) |
commit | 2a34b579381cd73a18553c331d91b99a42292367 (patch) | |
tree | d4c0ae6331fcbd1b4122ed3f364875ffd861d692 /Tests | |
parent | 77ec098b44ea036078a574754b6c935837a2fd75 (diff) | |
download | CMake-2a34b579381cd73a18553c331d91b99a42292367.zip CMake-2a34b579381cd73a18553c331d91b99a42292367.tar.gz CMake-2a34b579381cd73a18553c331d91b99a42292367.tar.bz2 |
CPack allow RPM and DEB generator to be used on OSX.
More generally add the check for possible generator "activation" at
runtime depending on a generator specific check.
The dynamic behavior is currently implemented only for MacOS
and should be fully backward compatible for other system.
Inspired-By Tom Hughes <tomtheengineer@gmail.com>
Diffstat (limited to 'Tests')
-rw-r--r-- | Tests/CMakeLists.txt | 48 |
1 files changed, 36 insertions, 12 deletions
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index c0b7cd6..7ce4c2e 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -699,6 +699,31 @@ ${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) + + 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 @@ -706,18 +731,17 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ if(APPLE) list(APPEND GENLST "DragNDrop") endif(APPLE) - if (CMAKE_SYSTEM_NAME MATCHES "Linux" AND NOT CMAKE_CURRENT_BINARY_DIR MATCHES ".* .*") - find_program(RPMBUILD NAMES rpmbuild) - endif(CMAKE_SYSTEM_NAME MATCHES "Linux" AND NOT CMAKE_CURRENT_BINARY_DIR MATCHES ".* .*") - if (RPMBUILD) - list(APPEND GENLST "RPM") - endif(RPMBUILD) - if (CMAKE_SYSTEM_NAME MATCHES "Linux") - find_program(DPKG NAMES dpkg) - if (DPKG) - list(APPEND GENLST "DEB") - endif(DPKG) - endif(CMAKE_SYSTEM_NAME MATCHES "Linux") + if (NOT CMAKE_CURRENT_BINARY_DIR MATCHES ".* .*") + list(FIND ACTIVE_CPACK_GENERATORS "RPM" RPM_ACTIVE) + if (NOT ${RPM_ACTIVE} EQUAL -1) + list(APPEND GENLST "RPM") + endif(NOT ${RPM_ACTIVE} EQUAL -1) + endif(NOT CMAKE_CURRENT_BINARY_DIR MATCHES ".* .*") + list(FIND ACTIVE_CPACK_GENERATORS "DEB" DEB_ACTIVE) + if (NOT ${DEB_ACTIVE} EQUAL -1) + list(APPEND GENLST "DEB") + endif(NOT ${DEB_ACTIVE} EQUAL -1) + # set up list of component packaging ways list(APPEND CWAYLST "default") list(APPEND CWAYLST "OnePackPerGroup") |