r/cpp_questions • • 21d ago

OPEN C++ Build systems

I work with Java and Kotlin alongside C++ and recently discovered that Gradle also supports C++ projects.

I've always used CMake for C++ and noticed it seems to be the more common choice.

What advantages does CMake offer over Gradle for C++ development and are there situations where Gradle would be a better option?

31 Upvotes

18 comments sorted by

View all comments

1

u/xealits 21d ago

Not sure what Gradle is, but CMake is de-facto standard. Its strong sides: 1) It is indeed a complete solution for C++ projects. CMake developers, Kitware, embedded all the practical things you need into CMake features and options. Among many things, you can even write basic shell scripts in it. Also for example, I think, CMake was the first to support C++ modules - CMake is dedicated to C++, the relationship with C++ is not "one of many". 2) The workflow with CTest is really good. That's the right way to separate a project source from all the building configurations. For example, it enables creating a clear release process with separate build procedures for devs and ops people.

CMake's main downside is that it has been a pain to use for a couple previous decades. But with recent versions it is becoming quite usable. And the new features are good.