diff options
author | Alexander Neundorf <neundorf@kde.org> | 2007-08-03 19:26:30 (GMT) |
---|---|---|
committer | Alexander Neundorf <neundorf@kde.org> | 2007-08-03 19:26:30 (GMT) |
commit | 68674bd0d795b1d560e8b819251480a753ba9882 (patch) | |
tree | db448fae4ab974786009ff09a6fea7c052b0137b /Modules/CPack.cmake | |
parent | bf0c200f0a8f494f3e78465ab8be0763ecdcbb6d (diff) | |
download | CMake-68674bd0d795b1d560e8b819251480a753ba9882.zip CMake-68674bd0d795b1d560e8b819251480a753ba9882.tar.gz CMake-68674bd0d795b1d560e8b819251480a753ba9882.tar.bz2 |
ENH: better error messages from the debian package generator
-don't display the cpack help if a generator failed with some problem
-check for cmSystemTools::GetErrorOccuredFlag()
Alex
Diffstat (limited to 'Modules/CPack.cmake')
-rw-r--r-- | Modules/CPack.cmake | 98 |
1 files changed, 73 insertions, 25 deletions
diff --git a/Modules/CPack.cmake b/Modules/CPack.cmake index 7f496aa..ac9be77 100644 --- a/Modules/CPack.cmake +++ b/Modules/CPack.cmake @@ -80,34 +80,82 @@ cpack_set_if_not_set(CPACK_PACKAGE_INSTALL_DIRECTORY cpack_set_if_not_set(CPACK_PACKAGE_INSTALL_REGISTRY_KEY "${CPACK_PACKAGE_NAME} ${CPACK_PACKAGE_VERSION}") -MACRO(cpack_check_file_exists file description) -IF(NOT EXISTS "${file}") - MESSAGE(SEND_ERROR "CPack ${description} file: \"${file}\" could not be found.") -ENDIF(NOT EXISTS "${file}") -ENDMACRO(cpack_check_file_exists) +macro(cpack_check_file_exists file description) + if(NOT EXISTS "${file}") + message(SEND_ERROR "CPack ${description} file: \"${file}\" could not be found.") + endif(NOT EXISTS "${file}") +endmacro(cpack_check_file_exists) + cpack_check_file_exists("${CPACK_PACKAGE_DESCRIPTION_FILE}" "package description") cpack_check_file_exists("${CPACK_RESOURCE_FILE_LICENSE}" "license resource") cpack_check_file_exists("${CPACK_RESOURCE_FILE_README}" "readme resource") cpack_check_file_exists("${CPACK_RESOURCE_FILE_WELCOME}" "welcome resource") -# Pick a generator -IF(NOT CPACK_GENERATOR) - IF(UNIX) - IF(APPLE) - SET(CPACK_GENERATOR "PackageMaker;STGZ;TGZ") - ELSE(APPLE) - SET(CPACK_GENERATOR "STGZ;TGZ;TZ") - ENDIF(APPLE) - SET(CPACK_SOURCE_GENERATOR "TGZ;TZ") - IF(CYGWIN) - SET(CPACK_SOURCE_GENERATOR "CygwinSource") - SET(CPACK_GENERATOR "CygwinBinary") - ENDIF(CYGWIN) - ELSE(UNIX) - SET(CPACK_GENERATOR "NSIS;ZIP") - SET(CPACK_SOURCE_GENERATOR "ZIP") - ENDIF(UNIX) -ENDIF(NOT CPACK_GENERATOR) +macro(cpack_optional_append _list _cond _item) + if(${_cond}) + set(${_list} ${${_list}} ${_item}) + endif(${_cond}) +endmacro(cpack_optional_append _list _cond _item) + +# Provide options to choose generators +# we might check here if the required tools for the generates exist +# and set the defaults according to the results +if(NOT CPACK_GENERATOR) + if(UNIX) + if(CYGWIN) + option(CPACK_CYGWIN_BINARY "Enable to build Cygwin binary packages" ON) + else(CYGWIN) + if(APPLE) + option(CPACK_PACKAGEMAKER "Enable to build PackageMaker packages" ON) + option(CPACK_OSXX11 "Enable to build OSX X11 packages" ON) + else(APPLE) + option(CPACK_TZ "Enable to build TZ packages" ON) + endif(APPLE) + option(CPACK_STGZ "Enable to build STGZ packages" ON) + option(CPACK_TGZ "Enable to build TGZ packages" ON) + option(CPACK_TBZ2 "Enable to build TBZ2 packages" ON) + option(CPACK_DEB "Enable to build Debian packages" OFF) + option(CPACK_NSIS "Enable to build NSIS packages" OFF) + endif(CYGWIN) + else(UNIX) + option(CPACK_NSIS "Enable to build NSIS packages" ON) + option(CPACK_ZIP "Enable to build ZIP packages" ON) + endif(UNIX) + + cpack_optional_append(CPACK_GENERATOR CPACK_PACKAGEMAKER PackageMaker) + cpack_optional_append(CPACK_GENERATOR CPACK_OSXX11 OSXX11) + cpack_optional_append(CPACK_GENERATOR CPACK_CYGWIN_BINARY CygwinBinary) + cpack_optional_append(CPACK_GENERATOR CPACK_DEB DEB) + cpack_optional_append(CPACK_GENERATOR CPACK_NSIS NSIS) + cpack_optional_append(CPACK_GENERATOR CPACK_STGZ STGZ) + cpack_optional_append(CPACK_GENERATOR CPACK_TGZ TGZ) + cpack_optional_append(CPACK_GENERATOR CPACK_TBZ2 TBZ2) + cpack_optional_append(CPACK_GENERATOR CPACK_TZ TZ) + cpack_optional_append(CPACK_GENERATOR CPACK_ZIP ZIP) + +endif(NOT CPACK_GENERATOR) + +# Provide options to choose source generators +if(NOT CPACK_SOURCE_GENERATOR) + if(UNIX) + if(CYGWIN) + option(CPACK_SOURCE_CYGWIN "Enable to build Cygwin source packages" ON) + else(CYGWIN) + option(CPACK_SOURCE_TBZ2 "Enable to build TBZ2 source packages" ON) + option(CPACK_SOURCE_TGZ "Enable to build TGZ source packages" ON) + option(CPACK_SOURCE_TZ "Enable to build TZ source packages" ON) + option(CPACK_SOURCE_ZIP "Enable to build ZIP source packages" OFF) + endif(CYGWIN) + else(UNIX) + option(CPACK_SOURCE_ZIP "Enable to build ZIP source packages" ON) + endif(UNIX) + + cpack_optional_append(CPACK_SOURCE_GENERATOR CPACK_SOURCE_CYGWIN CygwinSource) + cpack_optional_append(CPACK_SOURCE_GENERATOR CPACK_SOURCE_TGZ TGZ) + cpack_optional_append(CPACK_SOURCE_GENERATOR CPACK_SOURCE_TBZ2 TBZ2) + cpack_optional_append(CPACK_SOURCE_GENERATOR CPACK_SOURCE_TZ TZ) + cpack_optional_append(CPACK_SOURCE_GENERATOR CPACK_SOURCE_ZIP ZIP) +endif(NOT CPACK_SOURCE_GENERATOR) # Set some other variables cpack_set_if_not_set(CPACK_INSTALL_CMAKE_PROJECTS @@ -127,7 +175,7 @@ cpack_set_if_not_set(CPACK_USE_DESTDIR ON) cpack_set_if_not_set(CPACK_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}") cpack_encode_variables() -CONFIGURE_FILE("${cpack_input_file}" "${CPACK_OUTPUT_CONFIG_FILE}" @ONLY IMMEDIATE) +configure_file("${cpack_input_file}" "${CPACK_OUTPUT_CONFIG_FILE}" @ONLY IMMEDIATE) # Generate source file cpack_set_if_not_set(CPACK_SOURCE_INSTALLED_DIRECTORIES @@ -146,5 +194,5 @@ SET(CPACK_IGNORE_FILES "${CPACK_SOURCE_IGNORE_FILES}") SET(CPACK_STRIP_FILES "${CPACK_SOURCE_STRIP_FILES}") cpack_encode_variables() -CONFIGURE_FILE("${cpack_source_input_file}" +configure_file("${cpack_source_input_file}" "${CPACK_SOURCE_OUTPUT_CONFIG_FILE}" @ONLY IMMEDIATE) |