if (CPACK_GENERATOR MATCHES "TGZ")

    set(CPACK_ARCHIVE_COMPONENT_INSTALL ON)

    set(CPACK_COMPONENT_HDR_GROUP "src")
    set(CPACK_COMPONENT_SRC_GROUP "src")

elseif (CPACK_GENERATOR MATCHES "DEB")

    set(CPACK_DEB_COMPONENT_INSTALL ON)

    set(CPACK_COMPONENT_BIN_GROUP "bin")
    set(CPACK_COMPONENT_HDR_GROUP "bin")
    set(CPACK_COMPONENT_SRC_GROUP "src")

    set(CPACK_COMPONENT_GROUP_BIN_DEPENDS hdr)

    execute_process(COMMAND dpkg --print-architecture OUTPUT_VARIABLE ARCHITECTURE)
    string(REPLACE "\n" "" ARCHITECTURE ${ARCHITECTURE})

    set(CPACK_DEBIAN_PACKAGE_MAINTAINER "Sergei Fundaev <fundaev@satracks.org>")
    set(CPACK_DEBIAN_PACKAGE_SECTION "Science")
    set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE ${ARCHITECTURE})
    set(CPACK_PACKAGE_FILE_NAME ${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}_${CPACK_DEBIAN_PACKAGE_ARCHITECTURE})

elseif (CPACK_GENERATOR MATCHES "RPM")

    set(CPACK_RPM_COMPONENT_INSTALL ON)

    set(CPACK_COMPONENT_BIN_GROUP "bin")
    set(CPACK_COMPONENT_HDR_GROUP "bin")
    set(CPACK_COMPONENT_SRC_GROUP "src")

endif ()