diff options
author | 2017-07-27 17:33:11 +0200 | |
---|---|---|
committer | 2017-07-27 17:33:11 +0200 | |
commit | a78f50b38d8753667da416ea64d5c6b5f29c0a3e (patch) | |
tree | 947626c03a4b3e79a8af222a5d2c94af5b131a8b /cmake/cmake.d/01-variables.cmake | |
parent | 97348c43db647c0025919350383ce7d561761cb4 (diff) | |
parent | dee58363ddb98f8e63239035f1a8f1ab151c5e96 (diff) |
Merge remote-tracking branch 'origin/master' into dabdab_4.0.3dab_4.0.2dab_4.0.1dab_4.0.0dab/4.0.3dab/4.0.2dab/4.0.1dab/4.0.04.0.34.0.24.0.14.0.0
Diffstat (limited to 'cmake/cmake.d/01-variables.cmake')
-rw-r--r-- | cmake/cmake.d/01-variables.cmake | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/cmake/cmake.d/01-variables.cmake b/cmake/cmake.d/01-variables.cmake index 1bba5ce..3891f53 100644 --- a/cmake/cmake.d/01-variables.cmake +++ b/cmake/cmake.d/01-variables.cmake @@ -71,6 +71,21 @@ else() set(OSRELEASE "NOT DEBIAN OS") endif() +if(DEFINED ENV{SDKTARGETSYSROOT}) + file(STRINGS $ENV{SDKTARGETSYSROOT}/usr/include/linux/version.h LINUX_VERSION_CODE_LINE REGEX "LINUX_VERSION_CODE") +elseif(DEFINED ENV{PKG_CONFIG_SYSROOT_DIR}) + file(STRINGS $ENV{PKG_CONFIG_SYSROOT_DIR}/usr/include/linux/version.h LINUX_VERSION_CODE_LINE REGEX "LINUX_VERSION_CODE") +else() + file(STRINGS /usr/include/linux/version.h LINUX_VERSION_CODE_LINE REGEX "LINUX_VERSION_CODE") +endif() + +string(REGEX MATCH "[0-9]+" LINUX_VERSION_CODE ${LINUX_VERSION_CODE_LINE}) +math(EXPR a "${LINUX_VERSION_CODE} >> 16") +math(EXPR b "(${LINUX_VERSION_CODE} >> 8) & 255") +math(EXPR c "(${LINUX_VERSION_CODE} & 255)") + +set(KERNEL_VERSION "${a}.${b}.${c}") + # Include project configuration # ------------------------------ project(${PROJECT_NAME} VERSION ${PROJECT_VERSION} LANGUAGES ${PROJECT_LANGUAGES}) |