summaryrefslogtreecommitdiffstats
path: root/src/rocksdb/cmake/modules/ReadVersion.cmake
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-21 11:54:28 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-21 11:54:28 +0000
commite6918187568dbd01842d8d1d2c808ce16a894239 (patch)
tree64f88b554b444a49f656b6c656111a145cbbaa28 /src/rocksdb/cmake/modules/ReadVersion.cmake
parentInitial commit. (diff)
downloadceph-upstream/18.2.2.tar.xz
ceph-upstream/18.2.2.zip
Adding upstream version 18.2.2.upstream/18.2.2
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/rocksdb/cmake/modules/ReadVersion.cmake')
-rw-r--r--src/rocksdb/cmake/modules/ReadVersion.cmake10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/rocksdb/cmake/modules/ReadVersion.cmake b/src/rocksdb/cmake/modules/ReadVersion.cmake
new file mode 100644
index 000000000..ebfd7d6f9
--- /dev/null
+++ b/src/rocksdb/cmake/modules/ReadVersion.cmake
@@ -0,0 +1,10 @@
+# Read rocksdb version from version.h header file.
+
+function(get_rocksdb_version version_var)
+ file(READ "${CMAKE_CURRENT_SOURCE_DIR}/include/rocksdb/version.h" version_header_file)
+ foreach(component MAJOR MINOR PATCH)
+ string(REGEX MATCH "#define ROCKSDB_${component} ([0-9]+)" _ ${version_header_file})
+ set(ROCKSDB_VERSION_${component} ${CMAKE_MATCH_1})
+ endforeach()
+ set(${version_var} "${ROCKSDB_VERSION_MAJOR}.${ROCKSDB_VERSION_MINOR}.${ROCKSDB_VERSION_PATCH}" PARENT_SCOPE)
+endfunction()