summaryrefslogtreecommitdiffstats
path: root/cmake
diff options
context:
space:
mode:
authorManuel Bentele2020-10-14 09:56:44 +0200
committerManuel Bentele2020-10-14 09:56:44 +0200
commitde273f03c090748c5128540b0de742b2b1c5e5f4 (patch)
tree3c8c0b961e324494f4a2438a9c452cf391e54880 /cmake
parentAdded support to keep track of kernel file changes in CMake (diff)
downloadxloop-de273f03c090748c5128540b0de742b2b1c5e5f4.tar.gz
xloop-de273f03c090748c5128540b0de742b2b1c5e5f4.tar.xz
xloop-de273f03c090748c5128540b0de742b2b1c5e5f4.zip
Set Linux kernel version to unknown if it is not detectable
This change will command CMake to set the Linux kernel version to unknown if the kernel version can not be detected from the string defined in KERNEL_BUILD_DIR.
Diffstat (limited to 'cmake')
-rw-r--r--cmake/version.cmake5
1 files changed, 4 insertions, 1 deletions
diff --git a/cmake/version.cmake b/cmake/version.cmake
index 1cae665..07483af 100644
--- a/cmake/version.cmake
+++ b/cmake/version.cmake
@@ -6,7 +6,10 @@
# macro to get Linux kernel version from KERNEL_BUILD_DIR
macro(get_kernel_version LINUX_KERNEL_VERSION KERNEL_BUILD_DIR)
- string(REGEX MATCH "[0-9]+.[0-9]+.[0-9]+" LINUX_KERNEL_VERSION ${KERNEL_BUILD_DIR})
+ string(REGEX MATCH "[0-9]+\\.[0-9]+\\.[0-9]+" LINUX_KERNEL_VERSION ${KERNEL_BUILD_DIR})
+ if(LINUX_KERNEL_VERSION STREQUAL "")
+ set(LINUX_KERNEL_VERSION "unknown")
+ endif()
endmacro(get_kernel_version)
# macro to get short hash of latest commit