Have an amazing solution built in RAD Studio? Let us know. Looking for discounts? Visit our Special Offers page!

New in 10.2.3: Using CMake with Ninja

One big new feature in 10.2.3 is support for building with CMake. If you haven’t already, read the previous two posts: introduction to CMake and building with Windows, and building for iOS and Android.

Today I’d like to cover using CMake generators, and specifically Ninja for fast parallel builds.


What are CMake Generators?

CMake is a compiler- and platform-independent project system, but despite its name it doesn’t actually do any making or building. Instead, it uses the tools already on your system, and converts the CMakeLists.txt file into the data these tools need to build.  This conversion is a generator: it generates the files / data for a specific build system.  Thus, once you’ve generated these once, you use that tool to build.  You only need to re-run CMake itself if your project changes, eg by adding a new file, ro changing config.

Specify the generator with the -G command line switch.

You can, if you want, use old-fashioned makefiles.  Do so with -G”BorlandMakeFiles”, if you want to use make. You could use any of the other generators too. However, the one that we specifically support with CMake is Ninja.

What is Ninja?

Ninja is a very small and fast build system.  It comes as a single EXE, just like a traditional Delphi or C++Builder app.  It also allows parallel builds.  C++Builder already supports parallel compilation, but Ninja has a very nice implementation.

To use it, specify -G Ninja on the command line:

Here, building for Android (using the bccaarm toolchain file.)  CMake will do its stuff and, using the Ninja generator, create a few files Ninja uses to build:

Then, once CMake is complete, you can build your project just by invoking ninja:

Simple as that! Ninja will take over and build – and do so in parallel. If you open Task Manager, you can see multiple copies of the compiler:

And the command line serializes the parallel output, and you can see here the status as several steps of seven are completed.


Using Ninja is very easy – in fact, all our examples use it, and our documentation includes the steps to install.

It is a fast, lightweight build system that is a great addition to using CMake in general, for parallel building on your local machine.



Reduce development time and get to market faster with RAD Studio, Delphi, or C++Builder.
Design. Code. Compile. Deploy.
Start Free Trial   Upgrade Today

   Free Delphi Community Edition   Free C++Builder Community Edition

About author

David is an Australian developer, currently living in far-north Europe. He is the senior product manager for C++ at Idera, looking after C++Builder and Visual Assist.

1 Comment

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.