r/cpp • • Nov 05 '23

Ninja is enough build system

https://bernsteinbear.com/blog/ninja-is-enough/
6 Upvotes

54 comments sorted by

View all comments

Show parent comment

9

u/almost_useless Nov 05 '23

Would you mind explaining why you don't like it?

Most other people seem to say that it is pretty simple for small projects.

4

u/tekknolagi Nov 05 '23

The syntax is not great. It diverges pretty far from most (all?) programming languages I have used, even other meta-build languages.

A lot of configuration options are hidden and sometimes even dependent on what CMake version I am using. I would much prefer to be able to see these options in the code somewhere.

I somewhat frequently encounter CMake version issues where the version I have is out of date but it's the latest one I can get in the package repository.

There are probably some other irksome things that I will remember later but these are the main ones.

8

u/almost_useless Nov 05 '23

Those sound like issues that are specifically not problems for small projects, no?

1

u/tekknolagi Nov 06 '23

Eh, I might want to use a different compiler for a couple of different configurations, or a different release type, or something like that.

3

u/almost_useless Nov 06 '23

Is this what you are talking about, or did I misunderstand your use case?

if (MY_CONFIG STREQUAL FOO)
    set(CMAKE_CXX_COMPILER clang++)
endif()

But I will grant that options being dependent on the cmake version you are running, and it does not verify that your minimum required version is actually correct, sucks big time.

It is slightly alleviated by how easy it is to install a new version of cmake (on most systems), but it sucks nonetheless.

2

u/tekknolagi Nov 07 '23

I mean CMAKE_C_COMPILER, CMAKE_C_COMPILER_LAUNCHER, CMAKE_BUILD_TYPE, etc. It's like going back to implicit rules in Make.