From de273f03c090748c5128540b0de742b2b1c5e5f4 Mon Sep 17 00:00:00 2001 From: Manuel Bentele Date: Wed, 14 Oct 2020 09:56:44 +0200 Subject: 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. --- cmake/version.cmake | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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 -- cgit v1.2.3-55-g7522