
message(STATUS "Enabling package generation...")

set(CPACK_PACKAGE_NAME "libdht")
set(CPACK_SYSTEM_NAME "Linux")

set(CPACK_PACKAGE_VERSION_MAJOR 1)
set(CPACK_PACKAGE_VERSION_MINOR 0)
set(CPACK_PACKAGE_VERSION_PATCH 0)
set(CPACK_PACKAGE_VERSION "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}")

set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-${CPACK_SYSTEM_NAME}-${CMAKE_SYSTEM_PROCESSOR}")
set(CPACK_SOURCE_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-src")

set(CPACK_STRIP_FILES ON)
set(CPACK_PACKAGE_VENDOR "Emil Gedda")
set(CPACK_PACKAGE_CONTACT "Emil Gedda <emil.gedda@emilgedda.se>")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "A library for interfacing with the DHT11/DHT22 modules")

set(CPACK_RESOURCE_FILE_LICENSE "${PROJECT_SOURCE_DIR}/LICENSE")
set(CPACK_RESOURCE_FILE_README "${PROJECT_SOURCE_DIR}/README.md")

set(CPACK_SOURCE_GENERATOR "TGZ")
set(CPACK_GENERATOR "DEB;RPM")

set(CPACK_SOURCE_IGNORE_FILES
    /.git
    /bin
    /compile_commands.json
    /.clangd
    /.gitignore
)

# DEB
set(CPACK_DEBIAN_PACKAGE_HOMEPAGE "https://github.com/EmilGedda/libdht")

# RPM
set(PACK_RPM_PACKAGE_LICENSE "Boost")

include(CPack)

# Only works with the Ninja generator
add_custom_target(dist DEPENDS package package_source)
