diff options
-rw-r--r-- | README_d/README.cmake | 9 | ||||
-rw-r--r-- | cmake/package.cmake | 29 |
2 files changed, 30 insertions, 8 deletions
diff --git a/README_d/README.cmake b/README_d/README.cmake index b291d1be..7a61aed4 100644 --- a/README_d/README.cmake +++ b/README_d/README.cmake @@ -58,8 +58,13 @@ but use a different build directory. When using CMake, do this: Write a new Toolchain file for your cross-compiler and use it. - How can I build an installable file ? -Use "make package". The exact kind of installable file depends on your -operating system and defaults to TGZ. +By default, installable files will not be generated. +But if you instruct CMake about the kind of installable file you want, +then some kinds of files can be generated. +The exact kind of installable file depends on your operating system. +Possible kinds are TGZ (.tar.gz file), RPM (.rpm file), and DEB (.deb file). + cmake -DCPACK_GENERATOR=DEB .. + make package - Can I build an executable that runs on any Win32 platform ? Yes, there are two ways of doing this. diff --git a/cmake/package.cmake b/cmake/package.cmake index 203a8c3b..f1127797 100644 --- a/cmake/package.cmake +++ b/cmake/package.cmake @@ -41,14 +41,31 @@ IF (WIN32) set(CPACK_NSIS_MENU_LINKS "http://www.gnu.org/software/gawk" "GNU Awk") set(CPACK_NSIS_MUI_ICON "${CMAKE_SOURCE_DIR}/cmake/auk.ico") set(CPACK_NSIS_MUI_UNIICON "${CMAKE_SOURCE_DIR}/cmake/auk.ico") + set(CPACK_NSIS_MODIFY_PATH true) set(CPACK_NSIS_CONTACT "bug-gawk@gnu.org") set(CPACK_NSIS_DISPLAY_NAME "GNU Awk") + include(CPack) ELSE() - SET(CPACK_PACKAGING_INSTALL_PREFIX /usr) - IF(NOT CPACK_GENERATOR) - SET(CPACK_GENERATOR "TGZ") - ENDIF() - message(STATUS "CPACK_GENERATOR set to ${CPACK_GENERATOR}") + set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}_${CPACK_PACKAGE_VERSION}_${CMAKE_SYSTEM_PROCESSOR}") + set(CPACK_PACKAGING_INSTALL_PREFIX /usr) + if (CPACK_GENERATOR STREQUAL "TGZ") + include(CPack) + elseif (CPACK_GENERATOR STREQUAL "RPM") + include(CPack) + elseif (CPACK_GENERATOR STREQUAL "DEB") + set(CPACK_DEBIAN_PACKAGE_MAINTAINER "${CPACK_PACKAGE_VENDOR} <${CPACK_PACKAGE_CONTACT}>") + set(CPACK_DEBIAN_PACKAGE_SECTION "interpreters") + set(CPACK_DEBIAN_PACKAGE_PRIORITY "optional") + set(CPACK_DEBIAN_ARCHITECTURE ${CMAKE_SYSTEM_PROCESSOR}) + set(CPACK_DEBIAN_PACKAGE_HOMEPAGE "http://www.gnu.org/software/gawk") + set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON) + set(CPACK_DEBIAN_PACKAGE_DEPENDS "libc6 (>= 2.3.1-6), libgcc1 (>= 1:3.4.2-12)") + include(CPack) + else() + # No package format selected. Don't create the "package" target. + endif() + if (CPACK_GENERATOR) + message(STATUS "CPACK_GENERATOR set to ${CPACK_GENERATOR}") + endif() ENDIF() -INCLUDE(CPack) |