forked from alpaka-group/llama
-
Notifications
You must be signed in to change notification settings - Fork 0
/
llama-config-version.cmake
27 lines (22 loc) · 1.24 KB
/
llama-config-version.cmake
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
file(STRINGS "${CMAKE_CURRENT_LIST_DIR}/include/llama/llama.hpp" LLAMA_VERSION_MAJOR_HPP REGEX "#define LLAMA_VERSION_MAJOR ")
file(STRINGS "${CMAKE_CURRENT_LIST_DIR}/include/llama/llama.hpp" LLAMA_VERSION_MINOR_HPP REGEX "#define LLAMA_VERSION_MINOR ")
file(STRINGS "${CMAKE_CURRENT_LIST_DIR}/include/llama/llama.hpp" LLAMA_VERSION_PATCH_HPP REGEX "#define LLAMA_VERSION_PATCH ")
string(REGEX MATCH "([0-9]+)" LLAMA_VERSION_MAJOR ${LLAMA_VERSION_MAJOR_HPP})
string(REGEX MATCH "([0-9]+)" LLAMA_VERSION_MINOR ${LLAMA_VERSION_MINOR_HPP})
string(REGEX MATCH "([0-9]+)" LLAMA_VERSION_PATCH ${LLAMA_VERSION_PATCH_HPP})
set(PACKAGE_VERSION "${LLAMA_VERSION_MAJOR}.${LLAMA_VERSION_MINOR}.${LLAMA_VERSION_PATCH}")
# Check whether the requested PACKAGE_FIND_VERSION is exactly the one requested
if("${PACKAGE_VERSION}" EQUAL "${PACKAGE_FIND_VERSION}")
set(PACKAGE_VERSION_EXACT TRUE)
else()
set(PACKAGE_VERSION_EXACT FALSE)
endif()
# Check whether the requested PACKAGE_FIND_VERSION is compatible
if("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}")
set(PACKAGE_VERSION_COMPATIBLE FALSE)
else()
set(PACKAGE_VERSION_COMPATIBLE TRUE)
if ("${PACKAGE_VERSION}" VERSION_EQUAL "${PACKAGE_FIND_VERSION}")
set(PACKAGE_VERSION_EXACT TRUE)
endif()
endif()