feat: Add CPack packaging support for igmpgen
Updated `CMakeLists.txt` to integrate CPack, enabling the creation of RPM and DEB packages for the igmpgen project. Key changes include: - Project name updated for consistency. - Installation target set for the executable. - CPack configuration added for RPM, DEB, and TGZ packages, including essential metadata. This enhancement facilitates easier distribution and deployment of igmpgen across different platforms.
This commit is contained in:
parent
6e2ddf2d0b
commit
71f697b974
1 changed files with 33 additions and 1 deletions
|
@ -1,7 +1,7 @@
|
||||||
cmake_minimum_required(VERSION 3.25)
|
cmake_minimum_required(VERSION 3.25)
|
||||||
|
|
||||||
# Set the project name and version
|
# Set the project name and version
|
||||||
project(IGMPPacketGenerator VERSION 1.0)
|
project(igmpgen VERSION 1.0)
|
||||||
|
|
||||||
# Specify the C standard
|
# Specify the C standard
|
||||||
set(CMAKE_C_STANDARD 11)
|
set(CMAKE_C_STANDARD 11)
|
||||||
|
@ -22,3 +22,35 @@ target_link_directories(igmpgen PRIVATE /usr/lib)
|
||||||
|
|
||||||
# Link the executable to the libnet library
|
# Link the executable to the libnet library
|
||||||
target_link_libraries(igmpgen ${LIBNET_LIBRARY})
|
target_link_libraries(igmpgen ${LIBNET_LIBRARY})
|
||||||
|
|
||||||
|
# Installation instructions
|
||||||
|
install(TARGETS igmpgen DESTINATION bin)
|
||||||
|
|
||||||
|
# Include CPack for packaging
|
||||||
|
include(InstallRequiredSystemLibraries)
|
||||||
|
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE.txt")
|
||||||
|
set(CPACK_PACKAGE_VERSION_MAJOR "${igmpgen_VERSION_MAJOR}")
|
||||||
|
set(CPACK_PACKAGE_VERSION_MINOR "${igmpgen_VERSION_MINOR}")
|
||||||
|
|
||||||
|
# CPack RPM specific settings
|
||||||
|
set(CPACK_RPM_PACKAGE_LICENSE "MIT")
|
||||||
|
set(CPACK_RPM_PACKAGE_SUMMARY "IGMP Packet Generator")
|
||||||
|
set(CPACK_RPM_PACKAGE_NAME "igmpgen")
|
||||||
|
set(CPACK_RPM_PACKAGE_VERSION "${igmpgen_VERSION}")
|
||||||
|
set(CPACK_RPM_PACKAGE_RELEASE 1)
|
||||||
|
set(CPACK_RPM_PACKAGE_ARCHITECTURE "x86_64")
|
||||||
|
set(CPACK_RPM_PACKAGE_GROUP "Network")
|
||||||
|
set(CPACK_RPM_PACKAGE_VENDOR "Your Company/Organization")
|
||||||
|
set(CPACK_RPM_PACKAGE_DESCRIPTION "A tool for generating IGMP packets.")
|
||||||
|
|
||||||
|
# CPack DEB specific settings
|
||||||
|
set(CPACK_DEBIAN_PACKAGE_MAINTAINER "Your Name <your-email@example.com>")
|
||||||
|
set(CPACK_DEBIAN_PACKAGE_NAME "igmpgen")
|
||||||
|
set(CPACK_DEBIAN_PACKAGE_VERSION "${igmpgen_VERSION}")
|
||||||
|
set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE "amd64")
|
||||||
|
set(CPACK_DEBIAN_PACKAGE_SECTION "net")
|
||||||
|
set(CPACK_DEBIAN_PACKAGE_PRIORITY "optional")
|
||||||
|
set(CPACK_DEBIAN_PACKAGE_DESCRIPTION "A tool for generating IGMP packets.")
|
||||||
|
|
||||||
|
set(CPACK_GENERATOR "TGZ;RPM;DEB")
|
||||||
|
include(CPack)
|
||||||
|
|
Loading…
Add table
Reference in a new issue