Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add version header with AMQPCPP_VERSION preprocessor symbol #496

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,9 @@ install(DIRECTORY include/amqpcpp/ DESTINATION include/amqpcpp
FILES_MATCHING PATTERN "*.h")
install(FILES include/amqpcpp.h DESTINATION include)

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)

Expand Down
18 changes: 18 additions & 0 deletions src/version_template.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/**
* version.h
*
* Auto-generated by cmake.
*
* @copyright 2023 Copernica BV
*/

/**
* Include guard
*/
#pragma once

#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 )