[OE-core] [PATCH] Provide additional OECORE_EXTRA_SYSROOT variable

Andreas Cord-Landwehr cordlandwehr at kde.org
Mon Jan 9 19:22:24 UTC 2017


When compiling against a Yocto generated SDK and using an install folder
outside of the SDK's folder, CMake must be configure by using the
respective CMAKE_FIND_ROOT_PATH. This CMake cache variable is set
in the toolchain file and hence can only be configured via environment
variables; unless one wants to modify a project's CMake files.

This patch adds an additional environment variable OECORE_EXTRA_SYSROOT
to specify such an additional sysroot location that can optionally
be used when building against a Yocto SDK using this toolchain file.

Signed-off-by: Andreas Cord-Landwehr <cordlandwehr at kde.org>
---
 meta/recipes-devtools/cmake/cmake/OEToolchainConfig.cmake | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/meta/recipes-devtools/cmake/cmake/OEToolchainConfig.cmake b/meta/recipes-devtools/cmake/cmake/OEToolchainConfig.cmake
index 6518408c70..1927e0bdb4 100644
--- a/meta/recipes-devtools/cmake/cmake/OEToolchainConfig.cmake
+++ b/meta/recipes-devtools/cmake/cmake/OEToolchainConfig.cmake
@@ -4,7 +4,10 @@ set( CMAKE_CXX_FLAGS $ENV{CXXFLAGS}  CACHE STRING "" FORCE )
 set( CMAKE ASM_FLAGS ${CMAKE_C_FLAGS} CACHE STRING "" FORCE )
 set( CMAKE_LDFLAGS_FLAGS ${CMAKE_CXX_FLAGS} CACHE STRING "" FORCE )
 
-set( CMAKE_FIND_ROOT_PATH $ENV{OECORE_TARGET_SYSROOT} $ENV{OECORE_NATIVE_SYSROOT} )
+# Re-root CMake search tree to sysroot locations given by environment variables OECORE_TARGET_SYSROOT and
+# OECORE_NATIVE_SYSROOT. For additional locations, e.g. a cross-building install directory, use
+# the OECORE_EXTRA_SYSROOT variable.
+set( CMAKE_FIND_ROOT_PATH $ENV{OECORE_TARGET_SYSROOT} $ENV{OECORE_NATIVE_SYSROOT} $ENV{OECORE_EXTRA_SYSROOT} )
 set( CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER )
 set( CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY )
 set( CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY )
-- 
2.11.0




More information about the Openembedded-core mailing list