[OE-core] [PATCH 1/2] selftest: add cmake test

Armin Kuster akuster808 at gmail.com
Sat Jun 9 20:00:46 UTC 2018


This came out of Yocto bug 12762. We need to ensure cmake will support
various packages in core as they update.

Test case provided by Dennis Menschel <menschel-d at posteo.de>, thanks

Signed-off-by: Armin Kuster <akuster808 at gmail.com>
---
 .../recipes-test/cmake/cmake-boost-version-test.bb | 20 ++++++++++++++++++
 .../recipes-test/cmake/files/CMakeLists.txt        | 24 ++++++++++++++++++++++
 .../recipes-test/cmake/files/helloworld.cpp        |  7 +++++++
 3 files changed, 51 insertions(+)
 create mode 100644 meta-selftest/recipes-test/cmake/cmake-boost-version-test.bb
 create mode 100644 meta-selftest/recipes-test/cmake/files/CMakeLists.txt
 create mode 100644 meta-selftest/recipes-test/cmake/files/helloworld.cpp

diff --git a/meta-selftest/recipes-test/cmake/cmake-boost-version-test.bb b/meta-selftest/recipes-test/cmake/cmake-boost-version-test.bb
new file mode 100644
index 0000000..7bfd6ef
--- /dev/null
+++ b/meta-selftest/recipes-test/cmake/cmake-boost-version-test.bb
@@ -0,0 +1,20 @@
+#
+# This file was derived from the 'Hello World!' example recipe in the
+# Yocto Project Development Manual.
+#
+
+SUMMARY = "Simple helloworld application"
+SECTION = "examples"
+LICENSE = "MIT"
+LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
+
+DEPENDS = "boost"
+
+SRC_URI = " \
+    file://helloworld.cpp \
+    file://CMakeLists.txt \
+"
+
+S = "${WORKDIR}"
+
+inherit cmake
diff --git a/meta-selftest/recipes-test/cmake/files/CMakeLists.txt b/meta-selftest/recipes-test/cmake/files/CMakeLists.txt
new file mode 100644
index 0000000..2dc2c3f
--- /dev/null
+++ b/meta-selftest/recipes-test/cmake/files/CMakeLists.txt
@@ -0,0 +1,24 @@
+cmake_minimum_required(VERSION 3.8)
+
+project(example)
+
+find_package(Boost 1.60 REQUIRED
+    COMPONENTS
+        unit_test_framework
+)
+
+add_executable(example
+    helloworld.cpp
+)
+
+target_link_libraries(example
+    PRIVATE
+        Boost::unit_test_framework
+)
+
+install(
+    TARGETS
+        example
+    DESTINATION
+        bin
+)
diff --git a/meta-selftest/recipes-test/cmake/files/helloworld.cpp b/meta-selftest/recipes-test/cmake/files/helloworld.cpp
new file mode 100644
index 0000000..81ef9b9
--- /dev/null
+++ b/meta-selftest/recipes-test/cmake/files/helloworld.cpp
@@ -0,0 +1,7 @@
+#include <iostream>
+
+int main(int argc, char *argv[])
+{
+    std::cout << "Hello World!" << std::endl;
+    return 0;
+}
-- 
2.7.4




More information about the Openembedded-core mailing list