diff options
author | Pascal Bach <pascal.bach@siemens.com> | 2023-04-21 11:16:12 +0530 |
---|---|---|
committer | Steve Sakoman <steve@sakoman.com> | 2023-05-03 04:17:12 -1000 |
commit | c98c4d74dc4b920dc9dfffb26de738de854aff2a (patch) | |
tree | 1e4b878c44bcca53d5644b44703bed16808a71f1 /meta | |
parent | ca44c2d0dc06a347585e3d89afa116143e2e46df (diff) | |
download | poky-c98c4d74dc4b920dc9dfffb26de738de854aff2a.tar.gz |
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 <stdlib.h>"`
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.
(From OE-Core rev: 1105c67d554bcd155e8247cb16efc8d6a642444f)
Signed-off-by: Pascal Bach <pascal.bach@siemens.com>
(from http://lists.openembedded.org/pipermail/openembedded-core/2018-August/154791.html )
Signed-off-by: Mikko Rapeli <mikko.rapeli@bmw.de>
Signed-off-by: Poonam Jadhav <poonam.jadhav@kpit.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
Diffstat (limited to 'meta')
-rw-r--r-- | meta/classes/cmake.bbclass | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/meta/classes/cmake.bbclass b/meta/classes/cmake.bbclass index d9bcddbdbb..7ec6ca58fc 100644 --- a/meta/classes/cmake.bbclass +++ b/meta/classes/cmake.bbclass | |||
@@ -85,9 +85,12 @@ def map_host_arch_to_uname_arch(host_arch): | |||
85 | return "ppc64" | 85 | return "ppc64" |
86 | return host_arch | 86 | return host_arch |
87 | 87 | ||
88 | |||
88 | cmake_do_generate_toolchain_file() { | 89 | cmake_do_generate_toolchain_file() { |
89 | if [ "${BUILD_SYS}" = "${HOST_SYS}" ]; then | 90 | if [ "${BUILD_SYS}" = "${HOST_SYS}" ]; then |
90 | cmake_crosscompiling="set( CMAKE_CROSSCOMPILING FALSE )" | 91 | cmake_crosscompiling="set( CMAKE_CROSSCOMPILING FALSE )" |
92 | else | ||
93 | cmake_sysroot="set( CMAKE_SYSROOT \"${RECIPE_SYSROOT}\" )" | ||
91 | fi | 94 | fi |
92 | cat > ${WORKDIR}/toolchain.cmake <<EOF | 95 | cat > ${WORKDIR}/toolchain.cmake <<EOF |
93 | # CMake system name must be something like "Linux". | 96 | # CMake system name must be something like "Linux". |
@@ -120,6 +123,8 @@ set( CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY ) | |||
120 | set( CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY ) | 123 | set( CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY ) |
121 | set( CMAKE_PROGRAM_PATH "/" ) | 124 | set( CMAKE_PROGRAM_PATH "/" ) |
122 | 125 | ||
126 | $cmake_sysroot | ||
127 | |||
123 | # Use qt.conf settings | 128 | # Use qt.conf settings |
124 | set( ENV{QT_CONF_PATH} ${WORKDIR}/qt.conf ) | 129 | set( ENV{QT_CONF_PATH} ${WORKDIR}/qt.conf ) |
125 | 130 | ||