- I don't think these two statements are fully compatible:
> Do any of the following apply to you?
> - You want to avoid hard-coding paths
> ...
> If so, you’ll benefit from a CMake-like build system.
and
> Don’t GLOB files
I find it very annoying that I, a human, am expected to keep a current list of all source code files, when listing files is something that computers are very good at. They even tell us how to structure the project with a src folder, but I still have to remember to add or remove source code files to the right CMakeLists.txt when the content of that folder changes. It's poor design.
- CMake gets a lot of hate because a lot of large projects use it poorly and the syntax is strange, but I've found it invaluable for projects I've worked on. The first page of this site has a great list of reasons why someone would want to use CMake. I would recommend at least reading that far rather than reading "CMake" in the title and reflexively commenting something negative. I skimmed through and this seems like a nice resource to get people spun up on CMake, I'll recommend it to new users in the future.
- Even latest CMake version still has that terrible syntax. If they want to survive the competition, at some point they need to provide (an option at least) another, proper syntax.
- Modern CMake is Bazel or Gradle.
takes cover
- Related. Others?
An Introduction to Modern CMake - https://news.ycombinator.com/item?id=39784784 - March 2024 (28 comments)
An Introduction to Modern CMake - https://news.ycombinator.com/item?id=22577889 - March 2020 (41 comments)
An Introduction to Modern CMake - https://news.ycombinator.com/item?id=17897685 - Sept 2018 (122 comments)
by mrlonglong
0 subcomment
- I love cmake. It's a brilliant tool. I've used it extensively. In fact, I've recently reworked a large collection of applications and their C++ sources plus test units. The whole process was a joy.
by vrajspandya1
1 subcomments
- From last couple of years, VSCode's CMake Debugging plugin has made using CMake much easier. After using that I don't spend endless amounts of time figuring out what went wrong. This also helps me not to be afraid of CMake and I have started to like it.
by kevin_thibedeau
0 subcomment
- I do wish some brave soul would update the main parser to support generator expressions directly so they can have whitespace. Then make the end* commands have optional parens and you've almost got a decent language.
- Scons is very easy and readable yet very powerful. It is Python based and extensible.
https://scons.org/
by sirwhinesalot
1 subcomments
- For better or worse CMake has become a de-facto standard. You can (justifiably) argue Meson is better but honestly CMake is "good enough" and a slightly saner build system is not worth the loss of "standardization".
For C and C++, if I'm not using CMake, then I'm using some cobbled together shell scripts that do precisely what I need, no more, no less.
But for libraries there's a huge benefit to CMake since you can create a Config.cmake file for other projects to easily add your project as a dependency.
Or to use with FetchContent for rather nice dependency management.
The syntax is horrible, the semantics confusing, the way to do anything correctly weird and unintuitive like those generator expressions or whatever they're called and how the Config.cmake file is supposed to be generated. It is hot garbage.
But I'll still use it because the alternative is making dependency management in C/C++ land even worse.
- I'm switching all my C projects over to the Zig toolchain, and honestly, I'm not looking back.
- It is a noble attempt
But they should support more native languages
D
Odin
Rust
Nim
C3
Freebasic
Freepascal
- yeah CMake has been good to me past few years.