summaryrefslogtreecommitdiffstats
path: root/src/zstd/build/cmake/CMakeModules/GetZstdLibraryVersion.cmake
diff options
context:
space:
mode:
Diffstat (limited to 'src/zstd/build/cmake/CMakeModules/GetZstdLibraryVersion.cmake')
-rw-r--r--src/zstd/build/cmake/CMakeModules/GetZstdLibraryVersion.cmake9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/zstd/build/cmake/CMakeModules/GetZstdLibraryVersion.cmake b/src/zstd/build/cmake/CMakeModules/GetZstdLibraryVersion.cmake
new file mode 100644
index 00000000..8b6f394d
--- /dev/null
+++ b/src/zstd/build/cmake/CMakeModules/GetZstdLibraryVersion.cmake
@@ -0,0 +1,9 @@
+function(GetZstdLibraryVersion _header _major _minor _release)
+ # Read file content
+ FILE(READ ${_header} CONTENT)
+
+ string(REGEX MATCH ".*define ZSTD_VERSION_MAJOR *([0-9]+).*define ZSTD_VERSION_MINOR *([0-9]+).*define ZSTD_VERSION_RELEASE *([0-9]+)" VERSION_REGEX "${CONTENT}")
+ SET(${_major} ${CMAKE_MATCH_1} PARENT_SCOPE)
+ SET(${_minor} ${CMAKE_MATCH_2} PARENT_SCOPE)
+ SET(${_release} ${CMAKE_MATCH_3} PARENT_SCOPE)
+endfunction()