this post was submitted on 15 Aug 2024
685 points (98.4% liked)

Programmer Humor

19585 readers
984 users here now

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

founded 1 year ago
MODERATORS
 

Which will probably be never.

top 50 comments
sorted by: hot top controversial new old
[–] [email protected] 2 points 2 months ago* (last edited 2 months ago)

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

[–] [email protected] 3 points 3 months ago

I never finished reading my CMake book that weights about two kilos. It's now outdated, except for the core concepts.

[–] [email protected] 4 points 3 months ago

sudo make me a cmake

[–] [email protected] 25 points 3 months ago (1 children)

Grab a brush and put a little cmakeup.

[–] [email protected] 4 points 3 months ago (1 children)

Wrong class, you'll need cbrush.

[–] [email protected] 1 points 3 months ago

UNDEFINED SYMBOL AAHDYVBBDJFUE804746BBBB

[–] [email protected] 4 points 3 months ago

I’m in this photo and I don’t like it

[–] [email protected] 35 points 3 months ago (1 children)

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.

[–] [email protected] 8 points 3 months ago (1 children)

Even in VS? Nice, gonna check that out.

[–] [email protected] 10 points 3 months ago

Yeah, I wasn't aware of that until I found this article claiming it to be available.

[–] [email protected] 29 points 3 months ago (5 children)

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.

[–] [email protected] 4 points 3 months ago (1 children)

Manual makefiles don't scale though and you end up needing some other bootstrap framework pretty quick.

[–] [email protected] 1 points 3 months ago

How the heck does a Makefile not scale??? That's all it does!

[–] [email protected] 3 points 3 months ago

this is fine until you need autotools which is worse than cmake

[–] [email protected] 6 points 3 months ago (3 children)

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.

[–] [email protected] 1 points 3 months ago

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

[–] [email protected] 3 points 3 months ago

Xcode implies MacOS, you can use make there too, just beware that some commandline tools take different arguments on BSDs.

[–] [email protected] 3 points 3 months ago (1 children)

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 ?

[–] [email protected] 1 points 3 months ago

Tbh I’m not sure if you can. That’s proprietary IDEs for you.

[–] [email protected] 6 points 3 months ago* (last edited 3 months ago)

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.

[–] [email protected] 16 points 3 months ago* (last edited 3 months ago)

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.

[–] [email protected] 6 points 3 months ago (2 children)

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

[–] [email protected] 2 points 3 months ago (1 children)

I have legitimately never met a single person in real life who has anything positive to say about bazel, and I assume it it because they have all killed themselves.

[–] [email protected] -1 points 3 months ago

That's not a nice thing to say. When you grow up perhaps we can continue this discussion

[–] [email protected] 5 points 3 months ago* (last edited 3 months ago) (1 children)

Based on this comment*, I'll migrate a large project to bazel now. I'll report how it goes.

  • disclaimer: the comment just pushed me over the edge
[–] [email protected] 1 points 3 months ago (1 children)

Good luck, from my experience with bazel it may go smooth if you have someone who can into bazel to help you, and you create the project from scratch to then maintain small changes. Then there was my attempt to migrate an existing Java project to bazel without external help that failed hard (maybe the situation improved from 2021).

[–] [email protected] 3 points 3 months ago* (last edited 3 months ago)

Not sure about java, but I migrated a fairly big c++ project knowing only the basics of Bazel. Disclaimer: I know the codebase extremely well and we don't have any third party dependencies and the code is c++ and some python generators, validators, etc (which fits the bill for Bazel perfectly)

What I found super hard were toolchains. It's very verbose to define a toolchain

[–] [email protected] 9 points 3 months ago (2 children)

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.

https://crascit.com/professional-cmake/

[–] [email protected] 2 points 3 months ago

And an update has just been released today!

[–] [email protected] 1 points 3 months ago

Thanks a lot!

[–] [email protected] 14 points 3 months ago* (last edited 3 months ago)

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.

load more comments
view more: next ›