summaryrefslogtreecommitdiffstats
path: root/cmake
diff options
context:
space:
mode:
authorRomain Forlot <romain.forlot@iot.bzh>2017-08-29 17:50:05 +0200
committerRomain Forlot <romain.forlot@iot.bzh>2018-10-15 18:22:47 +0200
commit6a2f77212ca6d9809f4225ccf80147c56fb16c6e (patch)
treef198fdbce467609d60ac3909a4959814d36c4392 /cmake
parent4302525f6a37fa24c62d14a4af3beca8a85a7d12 (diff)
Fix: wrong OS detection when SDK env or Yocto
Change-Id: Iece230f0708129ea5980c61dae2d2cb66d32e7eb Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
Diffstat (limited to 'cmake')
-rw-r--r--cmake/cmake.d/02-variables.cmake11
-rw-r--r--cmake/common.cmake11
2 files changed, 11 insertions, 11 deletions
diff --git a/cmake/cmake.d/02-variables.cmake b/cmake/cmake.d/02-variables.cmake
index e69f342..0532c33 100644
--- a/cmake/cmake.d/02-variables.cmake
+++ b/cmake/cmake.d/02-variables.cmake
@@ -48,17 +48,6 @@ endif()
# Native packaging name
set(NPKG_PROJECT_NAME agl-${PROJECT_NAME})
-if(DEFINED ENV{SDKTARGETSYSROOT})
- file(STRINGS $ENV{SDKTARGETSYSROOT}/usr/include/linux/version.h LINUX_VERSION_CODE_LINE REGEX "LINUX_VERSION_CODE")
- set(BUILD_ENV_SYSROOT $ENV{SDKTARGETSYSROOT})
-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")
- set(BUILD_ENV_SYSROOT $ENV{PKG_CONFIG_SYSROOT_DIR})
-else()
- file(STRINGS /usr/include/linux/version.h LINUX_VERSION_CODE_LINE REGEX "LINUX_VERSION_CODE")
- set(BUILD_ENV_SYSROOT "")
-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")
diff --git a/cmake/common.cmake b/cmake/common.cmake
index ad5567a..041bb74 100644
--- a/cmake/common.cmake
+++ b/cmake/common.cmake
@@ -24,6 +24,17 @@
# Customise your preferences in "./conf.d/cmake/config.cmake"
#--------------------------------------------------------------------------
+if(DEFINED ENV{SDKTARGETSYSROOT})
+file(STRINGS $ENV{SDKTARGETSYSROOT}/usr/include/linux/version.h LINUX_VERSION_CODE_LINE REGEX "LINUX_VERSION_CODE")
+set(BUILD_ENV_SYSROOT $ENV{SDKTARGETSYSROOT})
+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")
+set(BUILD_ENV_SYSROOT $ENV{PKG_CONFIG_SYSROOT_DIR})
+else()
+file(STRINGS /usr/include/linux/version.h LINUX_VERSION_CODE_LINE REGEX "LINUX_VERSION_CODE")
+set(BUILD_ENV_SYSROOT "")
+endif()
+
# Get the os type
# Used to package .deb
set(OS_RELEASE_PATH "${BUILD_ENV_SYSROOT}/etc/os-release")