Skip to content

Commit

Permalink
Add a cpack configuration for library packaging
Browse files Browse the repository at this point in the history
  • Loading branch information
baptistepetit committed Sep 13, 2021
1 parent e60280f commit 4536cbd
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 3 deletions.
46 changes: 46 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -133,3 +133,49 @@ if(AMQP-CPP_LINUX_TCP)
find_package(OpenSSL REQUIRED)
target_include_directories(${PROJECT_NAME} PRIVATE ${OPENSSL_INCLUDE_DIR})
endif()

# software packaging
# ------------------------------------------------------------------------------------------------------

# if unix use deb and rpm generators, else default to .tar.gz
if (UNIX)
set(CPACK_GENERATOR DEB RPM)
endif (UNIX)

# general cpack settings
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "C++ library for communicating with a RabbitMQ message broker")
set(CPACK_PACKAGE_VENDOR "Coppernica Marketing Software")
set(CPACK_PACKAGE_CONTACT "Copernica <[email protected]>")
set(CPACK_PACKAGE_DESCRIPTION
"AMQP-CPP is a C++ library for communicating with a RabbitMQ message broker. The
library can be used to parse incoming data from a RabbitMQ server, and to
generate frames that can be sent to a RabbitMQ server."
)
set(CPACK_PACKAGE_HOMEPAGE_URL "https://github.com/CopernicaMarketingSoftware/AMQP-CPP")
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE")
set(CPACK_PACKAGE_VERSION_MAJOR ${VERSION_MAJOR})
set(CPACK_PACKAGE_VERSION_MINOR ${VERSION_MINOR})
set(CPACK_PACKAGE_VERSION_PATCH ${VERSION_PATCH})
set(CPACK_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS
OWNER_READ
OWNER_WRITE
OWNER_EXECUTE
GROUP_READ
GROUP_EXECUTE
WORLD_READ
WORLD_EXECUTE
)
set(CPACK_STRIP_FILES ON)

# deb generator related
set(CPACK_DEBIAN_PACKAGE_NAME "amqpcpp-dev")
set(CPACK_DEBIAN_PACKAGE_CONTROL_STRICT_PERMISSION TRUE)
set(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA "${CMAKE_CURRENT_SOURCE_DIR}/debian/triggers")

# rpm generator related
set(CPACK_RPM_PACKAGE_NAME "amqpcpp-devel")
set(CPACK_RPM_PACKAGE_DESCRIPTION ${CPACK_PACKAGE_DESCRIPTION})
set(CPACK_RPM_PACKAGE_LICENSE "ASL 2.0")

# create package target
include(CPack)
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,10 @@ On Windows you are required to define `NOMINMAX` when compiling code that includ

## Using cmake

The CMake file supports both building and installing. You can choose not to use
the install functionality, and instead manually use the build output at `build/bin/`. Keep
in mind that the TCP module is only supported for Linux. An example install method
The CMake file supports building, packaging, and installing. You can choose not to use
the install functionality, and instead manually use the build output at `build/bin/`.
You can also choose to generate packages for your system with the target `package` and install those.
Keep in mind that the TCP module is only supported for Linux. An example install method
would be:

```bash
Expand Down
1 change: 1 addition & 0 deletions debian/triggers
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
activate-noawait ldconfig

0 comments on commit 4536cbd

Please sign in to comment.