From 9c05356693f949ee526562eae65856e51ee0a5fe Mon Sep 17 00:00:00 2001 From: Richard Hazlewood Date: Thu, 2 Mar 2023 11:18:38 +0000 Subject: [PATCH 1/2] Add AMQPCPP_VERSION preprocessor symbol --- CMakeLists.txt | 4 ++++ src/version_template.h | 14 ++++++++++++++ 2 files changed, 18 insertions(+) create mode 100644 src/version_template.h diff --git a/CMakeLists.txt b/CMakeLists.txt index 18472046..01dd5dd7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -112,6 +112,10 @@ install(DIRECTORY include/amqpcpp/ DESTINATION include/amqpcpp FILES_MATCHING PATTERN "*.h") install(FILES include/amqpcpp.h DESTINATION include) +math(EXPR AMQPCPP_VERSION "${VERSION_MAJOR} << 16 | ${VERSION_MINOR} << 8 | ${VERSION_PATCH}" OUTPUT_FORMAT HEXADECIMAL) +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/version_template.h ${CMAKE_CURRENT_BINARY_DIR}/version.h) +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/version.h DESTINATION include/amqpcpp) + install(EXPORT ${PROJECT_NAME}Config DESTINATION cmake) export(TARGETS ${PROJECT_NAME} FILE ${PROJECT_NAME}Config.cmake) diff --git a/src/version_template.h b/src/version_template.h new file mode 100644 index 00000000..447c726d --- /dev/null +++ b/src/version_template.h @@ -0,0 +1,14 @@ +/** + * version.h + * + * Auto-generated by cmake. + * + * @copyright 2023 Copernica BV + */ + +/** + * Include guard + */ +#pragma once + +#define AMQPCPP_VERSION ( @AMQPCPP_VERSION@ + 0 ) From c30e571144dc4afe09e9a729b3d640a13fd1fe6e Mon Sep 17 00:00:00 2001 From: Richard Hazlewood Date: Mon, 20 Mar 2023 11:40:50 +0000 Subject: [PATCH 2/2] Make part-versions available --- CMakeLists.txt | 1 - src/version_template.h | 6 +++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 01dd5dd7..9a485a77 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -112,7 +112,6 @@ install(DIRECTORY include/amqpcpp/ DESTINATION include/amqpcpp FILES_MATCHING PATTERN "*.h") install(FILES include/amqpcpp.h DESTINATION include) -math(EXPR AMQPCPP_VERSION "${VERSION_MAJOR} << 16 | ${VERSION_MINOR} << 8 | ${VERSION_PATCH}" OUTPUT_FORMAT HEXADECIMAL) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/version_template.h ${CMAKE_CURRENT_BINARY_DIR}/version.h) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/version.h DESTINATION include/amqpcpp) diff --git a/src/version_template.h b/src/version_template.h index 447c726d..d7dc3ad5 100644 --- a/src/version_template.h +++ b/src/version_template.h @@ -11,4 +11,8 @@ */ #pragma once -#define AMQPCPP_VERSION ( @AMQPCPP_VERSION@ + 0 ) +#define AMQPCPP_VERSION_MAJOR ( @VERSION_MAJOR@ +0 ) +#define AMQPCPP_VERSION_MINOR ( @VERSION_MINOR@ +0 ) +#define AMQPCPP_VERSION_PATCH ( @VERSION_PATCH@ +0 ) + +#define AMQPCPP_VERSION ( AMQPCPP_VERSION_MAJOR << 16 | AMQPCPP_VERSION_MINOR << 8 | AMQPCPP_VERSION_PATCH )