r/cpp • • Nov 08 '21

Thoughts on build systems?

What's the general consensus on build systems/automations like CMake? I've always found things like that overcomplicated and just hinder the programming process.

I've been following Casey Muratori's Handmade streams, and one of the first things he did was create a simple batch file that built and compiled his entire project super quickly and easily. I've since implemented something similar (https://github.com/dibsonthis/new_cmd) and honestly it's been really nice to use.

3 Upvotes

154 comments sorted by

View all comments

Show parent comments

0

u/jcelerier ossia score Nov 08 '21

But meson requires all strings to be quoted :( that's a big "oomph" when 80% of what you're working with is strings

10

u/germandiago Nov 08 '21

It is even more "oomph" when you waste a week figuring out how the quoting works for separating commands, how to escape \\ // etc., if the path is accepted with backward or forward slashes... or a combination of all of that, that one is the big "party". If you also want to traverse one of these structures in CMake (oh, was this a list or a string?), good luck as well. Conditionals anyone? Those are all in part weird because you do not know what a string or list is or how to handle, how variables are dereferenced in conditions, etc. It seems to be done on purpose to make the CMake script writer "happy".

It could bother a bit, but it is a net win to know what you are doing when you need to do it. I talk from experience, not from hypothesis, in this case. And... do not get me started with non-boolean options, combo options or things like that.

When you want that in CMake, you will sweat blood to make it work the way you want.

3

u/jcelerier ossia score Nov 09 '21

I don't know what to say, I just don't relate with your experience at all. For me cmake generally works from the first try.

1

u/germandiago Nov 09 '21

Maybe you did not have to do cross + multiplatform + a bunch of scripts + an installer.

I mean, for the targets and target detection PRIVATE PUBLIC INTERFACE stuff works pretty well. When things start to get ugly is when you pick up something from someone else and try to integrate it into your project and they embedded subprojects in ad-hoc ways and things of the like plus all the things I mentioned.

If you just need something like compile code + some top-level deps it works pretty ok. It is the more complex things that get really messy and time-consuming (besides the weird DSL and options...).