[OE-core] [PATCH] cmake: Support Eclipse and other cmake generators

Douglas Royds douglas.royds at taitradio.com
Mon Apr 8 20:55:58 UTC 2019


From: Nikhil Pal Singh <nikhilpal.singh at taitradio.com>

As per Generators information mentioned in the cmake --help file
only "Unix Makefiles" and "Ninja" generators are supported as
standard project files.
With this change generic solution can be created for all the other
supported generators such as CodeBlocks, CodeLite, Eclipse CDT4,
KDevelop3, Kate and others for make or Ninja build systems.
It will also give and option to set OECMAKE_GENERATOR in local.conf
file for configuring any specific generators.

Signed-off-by: Nikhil Pal Singh <nikhilpal.singh at taitradio.com>
---
 meta/classes/cmake.bbclass | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/meta/classes/cmake.bbclass b/meta/classes/cmake.bbclass
index e16630434e..d3f0d70847 100644
--- a/meta/classes/cmake.bbclass
+++ b/meta/classes/cmake.bbclass
@@ -10,13 +10,14 @@ OECMAKE_GENERATOR ?= "Ninja"
 
 python() {
     generator = d.getVar("OECMAKE_GENERATOR")
-    if generator == "Unix Makefiles":
-        args = "-G 'Unix Makefiles' -DCMAKE_MAKE_PROGRAM=" + d.getVar("MAKE")
+    if "Unix Makefiles" in generator:
+        args = "-G '" + generator +  "' -DCMAKE_MAKE_PROGRAM=" + d.getVar("MAKE")
         d.setVar("OECMAKE_GENERATOR_ARGS", args)
         d.setVarFlag("do_compile", "progress", "percent")
-    elif generator == "Ninja":
+    elif "Ninja" in generator:
+        args = "-G '" + generator + "' -DCMAKE_MAKE_PROGRAM=ninja"
         d.appendVar("DEPENDS", " ninja-native")
-        d.setVar("OECMAKE_GENERATOR_ARGS", "-G Ninja -DCMAKE_MAKE_PROGRAM=ninja")
+        d.setVar("OECMAKE_GENERATOR_ARGS", args)
         d.setVarFlag("do_compile", "progress", r"outof:^\[(\d+)/(\d+)\]\s+")
     else:
         bb.fatal("Unknown CMake Generator %s" % generator)
-- 
2.17.1



More information about the Openembedded-core mailing list