mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 14:48:21 +00:00
GH-808: Add ZEEK_VERSION_NUMBER definition to zeek-config.h
This is the result of (major * 10000 + minor * 100 + patch), for example 3.1.2 becomes 30102. This definition may be helpful for external code that requires conditional compilation to support multiple Zeek versions with differing APIs.
This commit is contained in:
parent
bf212b2d3c
commit
48fba11c51
2 changed files with 9 additions and 1 deletions
|
@ -79,11 +79,14 @@ execute_process(COMMAND grep "^#define *BRO_PLUGIN_API_VERSION"
|
||||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||||
string(REGEX REPLACE "^#define.*VERSION *" "" API_VERSION "${API_VERSION}")
|
string(REGEX REPLACE "^#define.*VERSION *" "" API_VERSION "${API_VERSION}")
|
||||||
|
|
||||||
string(REPLACE "." " " version_numbers ${VERSION})
|
string(REGEX REPLACE "[.-]" " " version_numbers ${VERSION})
|
||||||
separate_arguments(version_numbers)
|
separate_arguments(version_numbers)
|
||||||
list(GET version_numbers 0 VERSION_MAJOR)
|
list(GET version_numbers 0 VERSION_MAJOR)
|
||||||
list(GET version_numbers 1 VERSION_MINOR)
|
list(GET version_numbers 1 VERSION_MINOR)
|
||||||
|
list(GET version_numbers 2 VERSION_PATCH)
|
||||||
set(VERSION_MAJ_MIN "${VERSION_MAJOR}.${VERSION_MINOR}")
|
set(VERSION_MAJ_MIN "${VERSION_MAJOR}.${VERSION_MINOR}")
|
||||||
|
math(EXPR ZEEK_VERSION_NUMBER
|
||||||
|
"${VERSION_MAJOR} * 10000 + ${VERSION_MINOR} * 100 + ${VERSION_PATCH}")
|
||||||
|
|
||||||
set(VERSION_C_IDENT "${VERSION}_plugin_${API_VERSION}")
|
set(VERSION_C_IDENT "${VERSION}_plugin_${API_VERSION}")
|
||||||
string(REGEX REPLACE "-[0-9]*$" "_git" VERSION_C_IDENT "${VERSION_C_IDENT}")
|
string(REGEX REPLACE "-[0-9]*$" "_git" VERSION_C_IDENT "${VERSION_C_IDENT}")
|
||||||
|
|
|
@ -131,6 +131,11 @@
|
||||||
/* Version number of package */
|
/* Version number of package */
|
||||||
#define VERSION "@VERSION@"
|
#define VERSION "@VERSION@"
|
||||||
|
|
||||||
|
// Zeek version number.
|
||||||
|
// This is the result of (major * 10000 + minor * 100 + patch)
|
||||||
|
// For example, 3.1.2 becomes 30102.
|
||||||
|
#define ZEEK_VERSION_NUMBER @ZEEK_VERSION_NUMBER@
|
||||||
|
|
||||||
/* whether words are stored with the most significant byte first */
|
/* whether words are stored with the most significant byte first */
|
||||||
#cmakedefine WORDS_BIGENDIAN
|
#cmakedefine WORDS_BIGENDIAN
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue