From 0b01920726661debbea836ba3ed0c2c27ff83364 Mon Sep 17 00:00:00 2001 From: Bill Somerville Date: Thu, 9 Oct 2014 19:04:26 +0000 Subject: [PATCH] Only do package generation if appropriate tools are available Debian packages are only build if dpkg-buildpackage is available and RPM package generation is only done if rpmbuild is available. Merged from wsjtx-1.4 branch. git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@4504 ab8295b8-cf94-4d9e-aec4-7959e3be5d79 --- CMakeLists.txt | 38 +++++++++++++++++++++++--------------- 1 file changed, 23 insertions(+), 15 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index fbef502bf..62310af99 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -969,22 +969,30 @@ if (WIN32) elseif (APPLE) set (CPACK_GENERATOR "DragNDrop") else () - # - # Derive the correct filename for a Debian package because the DEB - # generator doesn't do this correctly at present. - # - find_program (DPKG_PROGRAM dpkg DOC "dpkg program of Debian-based systems") - if (DPKG_PROGRAM) - execute_process ( - COMMAND ${DPKG_PROGRAM} --print-architecture - OUTPUT_VARIABLE CPACK_DEBIAN_PACKAGE_ARCHITECTURE - OUTPUT_STRIP_TRAILING_WHITESPACE - ) - else (DPKG_PROGRAM) - set (CPACK_DEBIAN_PACKAGE_ARCHITECTURE noarch) - endif (DPKG_PROGRAM) + find_program (DPKG_BUILDER dpkg-buildpackage DOC "Debian package builder") + if (DPKG_BUILDER) + # + # Derive the correct filename for a Debian package because the DEB + # generator doesn't do this correctly at present. + # + find_program (DPKG_PROGRAM dpkg DOC "dpkg program of Debian-based systems") + if (DPKG_PROGRAM) + execute_process ( + COMMAND ${DPKG_PROGRAM} --print-architecture + OUTPUT_VARIABLE CPACK_DEBIAN_PACKAGE_ARCHITECTURE + OUTPUT_STRIP_TRAILING_WHITESPACE + ) + else (DPKG_PROGRAM) + set (CPACK_DEBIAN_PACKAGE_ARCHITECTURE noarch) + endif (DPKG_PROGRAM) - set (CPACK_GENERATOR "DEB" "RPM") + list (APPEND CPACK_GENERATOR "DEB") + endif (DPKG_BUILDER) + + find_program (RPMBUILDER rpmbuild DOC "RPM package builder") + if (RPMBUILDER) + list (APPEND CPACK_GENERATOR "RPM") + endif (RPBUILDER) endif () set (CPACK_DEBIAN_PACKAGE_DESCRIPTION "${PROJECT_DESCRIPTION}")