Provide an easy way to enable cmake-qemu e.g. on distro level for all
recipes inheriting the cmake.bbclass.

Therefore a new variable is introduced: OECMAKE_EXEWRAPPER_QEMU.

If set to "1" all recipes built with CMake can use qemu to execute
cross-compiled binaries on the build machine.
One use case is the execution of cross-compiled unit tests or ptests,
e.g. in an SDK context. Therefore, a variable that activates Qemu for
all CMake recipes is much more useful than just providing the optional
cmake-qemu.bbclass.
Further information can be found in the CMake documentation in the
CMAKE_CROSSCOMPILING_EMULATOR section.

There are some use cases for qemu-user, but users should not be
encouraged to use it as an alternative for clean cross-compilation.
Since the core does not need it either it is optional.

Signed-off-by: Adrian Freihofer <[email protected]>
---
 meta/classes-recipe/cmake.bbclass | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/meta/classes-recipe/cmake.bbclass 
b/meta/classes-recipe/cmake.bbclass
index d978b88944..4d8e2a206f 100644
--- a/meta/classes-recipe/cmake.bbclass
+++ b/meta/classes-recipe/cmake.bbclass
@@ -14,6 +14,10 @@ B = "${WORKDIR}/build"
 # The supported options are "Unix Makefiles" or "Ninja".
 OECMAKE_GENERATOR ?= "Ninja"
 
+# qemu-user can be used for special use cases, but not by default
+OECMAKE_EXEWRAPPER_QEMU ??= "0"
+inherit ${@'cmake-qemu' if d.getVar('OECMAKE_EXEWRAPPER_QEMU') else ''}
+
 python() {
     generator = d.getVar("OECMAKE_GENERATOR")
     if "Unix Makefiles" in generator:
-- 
2.41.0

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#190880): 
https://lists.openembedded.org/g/openembedded-core/message/190880
Mute This Topic: https://lists.openembedded.org/mt/102708283/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to