Skip to content

Instantly share code, notes, and snippets.

@kurotych
Last active November 18, 2022 06:33
Show Gist options
  • Save kurotych/0bb94e906fc116f14a5f5060b2e6ef93 to your computer and use it in GitHub Desktop.
Save kurotych/0bb94e906fc116f14a5f5060b2e6ef93 to your computer and use it in GitHub Desktop.
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()
@kurotych
Copy link
Author

kurotych commented Feb 7, 2022

Hello @Bassem-Ramzy thanks for the hint! The gist was edited.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment