diff options
author | Adrian Freihofer <adrian.freihofer@gmail.com> | 2023-12-07 21:52:49 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2023-12-13 11:58:15 +0000 |
commit | 2df986746b4010a24def7369f356b50e52bda50d (patch) | |
tree | cfd49ffcb07ac7060eebbec53e571e74fa35107a /meta-selftest/recipes-test/cpp/cmake-example.bb | |
parent | d7c05e4eed4ed436f2ce961df46f9654af83ffec (diff) | |
download | poky-2df986746b4010a24def7369f356b50e52bda50d.tar.gz |
oe-selftest: add a cpp-example recipe
This simple C++ project supports compilation with CMake and Meson.
(Autotool support could be added later on.)
It's supposed to be used with oe-selftest.
An artificial project has several advantages over compiling a normal
CMake or Meson based project for testing purposes:
- It is much faster because it can be kept minimalistic
- It can cover multiple odd corner cases
- No one will change it in an unpredictable way
- It can support multiple build tools with only one C++ codebase
(From OE-Core rev: 4904e772470b0d6e5d98ef0344b3f2bf54214661)
Signed-off-by: Adrian Freihofer <adrian.freihofer@siemens.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta-selftest/recipes-test/cpp/cmake-example.bb')
-rw-r--r-- | meta-selftest/recipes-test/cpp/cmake-example.bb | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/meta-selftest/recipes-test/cpp/cmake-example.bb b/meta-selftest/recipes-test/cpp/cmake-example.bb new file mode 100644 index 0000000000..aecfcf780a --- /dev/null +++ b/meta-selftest/recipes-test/cpp/cmake-example.bb | |||
@@ -0,0 +1,25 @@ | |||
1 | # | ||
2 | # Copyright OpenEmbedded Contributors | ||
3 | # | ||
4 | # SPDX-License-Identifier: MIT | ||
5 | # | ||
6 | |||
7 | SUMMARY = "A C++ example compiled with cmake." | ||
8 | |||
9 | require cpp-example.inc | ||
10 | |||
11 | SRC_URI += "file://CMakeLists.txt" | ||
12 | |||
13 | inherit cmake-qemu | ||
14 | |||
15 | PACKAGECONFIG[failing_test] = "-DFAILING_TEST=ON" | ||
16 | |||
17 | FILES:${PN}-ptest += "${bindir}/test-cmake-example" | ||
18 | |||
19 | do_run_tests () { | ||
20 | bbnote ${DESTDIR:+DESTDIR=${DESTDIR} }${CMAKE_VERBOSE} cmake --build '${B}' --target test -- ${EXTRA_OECMAKE_BUILD} | ||
21 | eval ${DESTDIR:+DESTDIR=${DESTDIR} }${CMAKE_VERBOSE} cmake --build '${B}' --target test -- ${EXTRA_OECMAKE_BUILD} | ||
22 | } | ||
23 | do_run_tests[doc] = "Run cmake --target=test using qemu-user" | ||
24 | |||
25 | addtask do_run_tests after do_compile | ||