From: Pascal Bach Date: Fri, 21 Apr 2023 05:46:12 +0000 (+0530) Subject: cmake: add CMAKE_SYSROOT to generated toolchain file X-Git-Tag: 2022-04.10-kirkstone~32 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1105c67d554bcd155e8247cb16efc8d6a642444f;p=thirdparty%2Fopenembedded%2Fopenembedded-core.git cmake: add CMAKE_SYSROOT to generated toolchain file This already got fixed in the toolchain file that is used during development in https://github.com/openembedded/openembedded-core/commit/cb42802f2fe1760f894a435b07286bca3a220364 The toolchain file generated by the cmake.bbclass however does not set CMAKE_SYSROOT. Under certain circumstances this also leads to the error: `"stdlib.h: No such file or directory #include_next "` during the build of a recipe. An example where this accured was during the upgrade of the Apache Thrift recipe in meta-openembedded to 0.11.0. With this change the build works out of the box. CMAKE_SYSROOT must only be set when crosscompiling, otherwise it will interfere with the native compiler headers. Signed-off-by: Pascal Bach (from http://lists.openembedded.org/pipermail/openembedded-core/2018-August/154791.html ) Signed-off-by: Mikko Rapeli Signed-off-by: Poonam Jadhav Signed-off-by: Steve Sakoman --- diff --git a/meta/classes/cmake.bbclass b/meta/classes/cmake.bbclass index d9bcddbdbb1..7ec6ca58fc1 100644 --- a/meta/classes/cmake.bbclass +++ b/meta/classes/cmake.bbclass @@ -85,9 +85,12 @@ def map_host_arch_to_uname_arch(host_arch): return "ppc64" return host_arch + cmake_do_generate_toolchain_file() { if [ "${BUILD_SYS}" = "${HOST_SYS}" ]; then cmake_crosscompiling="set( CMAKE_CROSSCOMPILING FALSE )" + else + cmake_sysroot="set( CMAKE_SYSROOT \"${RECIPE_SYSROOT}\" )" fi cat > ${WORKDIR}/toolchain.cmake <