Skip to content

Instantly share code, notes, and snippets.

@kurotych
kurotych / check_linux_kernel_version.cmake
Last active November 18, 2022 06:33
How to check linux kernel version in cmake
execute_process(COMMAND uname -r OUTPUT_VARIABLE UNAME_RESULT OUTPUT_STRIP_TRAILING_WHITESPACE)
message(-- " Kernel version: " ${UNAME_RESULT})
string(REGEX MATCH "[0-9]+.[0-9]+" LINUX_KERNEL_VERSION ${UNAME_RESULT})
if (LINUX_KERNEL_VERSION VERSION_LESS 3.8)
message(FATAL_ERROR "Linux kernel version should be greater than 3.8")
endif()