if (CPACK_GENERATOR MATCHES "DEB")
    # For Debian packages, we have to specify our own dependency list. We can't use the automatic dependency generator
    # because CPack doesn't allow us to exclude dependencies that are shipped with Bloom. CPack uses dpkg-shlibdeps to
    # generate the dependencies, and there appears to be a -x option to exclude certain packages, but CPack doesn't
    # yet support this.

    # This list could probably be reduced. It was generated by CPack (via dpkg-shlibdeps)
    string(
        CONCAT
        CPACK_DEBIAN_PACKAGE_DEPENDS
        "libc6 (>= 2.18), "
        "libfontconfig1 (>= 2.11.94), "
        "libfreetype6 (>= 2.6), "
        "libgcc1 (>= 1:4.2), "
        "libgl1-mesa-glx | libgl1, "
        "libstdc++6 (>= 5), "
        "libudev1 (>= 183), "
        "libx11-6, "
        "libx11-xcb1, "
        "libxcb-icccm4 (>= 0.4.1), "
        "libxcb-image0 (>= 0.2.1), "
        "libxcb-keysyms1 (>= 0.4.0), "
        "libxcb-render-util0, "
        "libxext6, "
        "libxkbcommon-x11-0 (>= 0.5.0), "
        "libxkbcommon0 (>= 0.5.0), "
        "libxrender1, "
        "zlib1g (>= 1:1.1.4)"
    )

    set(
        CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA
        ${CMAKE_CURRENT_SOURCE_DIR}/resources/packaging/postinst;
        ${CMAKE_CURRENT_SOURCE_DIR}/resources/packaging/postrm
    )

elseif (CPACK_GENERATOR MATCHES "RPM")
    set(CPACK_RPM_PACKAGE_LICENSE "LGPLv3+")
    set(CPACK_RPM_PACKAGE_GROUP "Development/Debuggers")

    set(CPACK_RPM_PACKAGE_AUTOREQ ON)
    set(CPACK_RPM_REQUIRES_EXCLUDE_FROM "bin/lib/")

    set(CPACK_RPM_POST_INSTALL_SCRIPT_FILE ${CMAKE_CURRENT_SOURCE_DIR}/resources/packaging/postinst)
    set(CPACK_RPM_POST_UNINSTALL_SCRIPT_FILE ${CMAKE_CURRENT_SOURCE_DIR}/resources/packaging/postrm)
endif()
