Last active
November 18, 2022 06:33
-
-
Save kurotych/0bb94e906fc116f14a5f5060b2e6ef93 to your computer and use it in GitHub Desktop.
How to check linux kernel version in cmake
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello @Bassem-Ramzy thanks for the hint! The gist was edited.