Life is and will always be better writing your own Makefiles. It's literally so easy. I do not get the distaste. Cmake is arcane magic. Bazel is practically written in runes. Makefile is a just a glorified build script, but where you don't have to use a bunch of if statements to avoid building everything each time.
Programmer Humor
Welcome to Programmer Humor!
This is a place where you can post jokes, memes, humor, etc. related to programming!
For sharing awful code theres also Programming Horror.
Rules
- Keep content in english
- No advertisements
- Posts must be related to programming or programmer topics
really anyone worth their salt should write perl code to generate makefiles depending on the phase of the moon and if you sacrificed a $chicken, a @chicken, or a %chicken at runtime.
It's one of those massively elegant concepts of the past that's become unfashionable to learn pretty much just do to time and ubiquity.
That works until you need to support Visual Studio or Xcode. Then you either maintain their stuff manually too, or you get CMake to generate all three. I don’t love it but it solves the problem it’s meant to solve. The issue is people using it when they don’t need to.
Xcode implies MacOS, you can use make there too, just beware that some commandline tools take different arguments on BSDs.
I'm not familiar with either why can't you use Make with VS or Xcode? Can you not set them up to have whatever build bind call Make ?
Tbh I’m not sure if you can. That’s proprietary IDEs for you.
You can build with mingw64 built with msvc and use more or less the same Makefile. As for Xcode... well, there's not really a good reason to support Mac. On principle I wouldn't even try
Did you know that there is a debugger in Jetbrains CLion (and I think VS as well) that allows you to step through your CMake scripts? As ridiculous as this may seem, actually it is really useful.
Even in VS? Nice, gonna check that out.
Thanks for the laugh.
That was also my experience, but it ended when I stopped using cmake
.
I'm not mad at anyone for using cmake
, but I consider myself blessed on each day that I don't have to collaborate with them (on cmake
).
Which is weird, because someone will have to pry a Makefile
from my cold dead hands, someday.
Professional CMake: A Practical Guide by Craig Scott is an excellent guide to modern cmake usage. Well worth the $30 if you need to build, maintain, or modify a CMake project.
And an update has just been released today!
Thanks a lot!
The C in Cmake maybe stands for cat. It would make sense.
In case anyone wants to know the actual answer, it stands for cross platform make, and my understanding is that it’s for generating build project files for various development environments. For instance, with one CMake file you can generate a Visual Studio Solution file, an XCode project file, a Makefile, etc. Several IDEs are also able to read CMake files directly.
I like this idea!
This was solved by moving to bazel. It's a bit more verbose and resource heavy, but the language is sane and how you structure your build code makes a lot of sense
sudo make me a cmake
There are cmake debuggers where you can walk through exactly what it's doing line by line
Do you have a good one which you can recommend?
cmake debugger
I use this one in vscodium https://open-vsx.org/vscode/item?itemName=ms-vscode.cmake-tools
Thanks!
I forgot to assign a variable, now it crashes %5 of the time. It's wild how c doesn't default variables to null or something.
default variables to null or something
That is such a bad idea. Better to have the compiler warn you about it like in Rust, or have the linter / IDE highlight it.
If it's going to compile without any warnings I'd rather the app crash rather than continue execution with rogue values as it does now.
There is so much room for things like corrupted files or undocumented behavior until it crashes. Without the compiler babysitting you it's a lot easier to find broken variables when they don't point to garbage.
Just enable all compiler warnings (and disable the ones you don't care about), a good C compiler can tell you about using unassigned variables.
Still learning, they just covered compiler flags in cs. They didn't go into detail yet though.
Edit: I've used python for years and they have something equally dumb. You can have a function in a massive application that is broken and the moment it's called, the application crashes.
At any other point the application will just run as if nothing is wrong even though python evaluates everything at runtime. I'm sure they can't do much because the initial launch would be slow.
C does exactly what you tell it, no more. Why waste cycles setting a variable to a zero state when a correct program will set it to whatever initial state it expects? It is not user friendly, but it is performant.
It wouldn't be that much processing compared to the rest of the app. It would lot more efficient than running an effectively infinite loop or arithmetic on an arbitrarily large number as a result of an unsigned variables.
I’m in this photo and I don’t like it
Imo just use something else. If your build system is really simple just write the Makefiles yourself. If the build system tho needs to be really complex I would use something like meson or scons (Having worked on some gigantic fully GNU make build systems it can get pretty out of hand).
This is all a personal preference thing but cmake in my experience is really non intuitive and a pain to debug. I know it works for a lot of people but I definitely prefer particularly like scons since its python I have a bit easier time understanding what's happening.
If you really need to use cmake, use a debugger like another user commented. There's also a GNU make debugger in case you need to debug makefiles