Earlier quoted context omitted.
> I've worked with folks that have 20 years of experience that look at a makefile and say "Ugh what is this complicated mess, can you do it in cmake or bazel or something" This is so true, it happened to me more than once. A couple of projects ago, we had a complicated build process (7-8 manual build steps that depend on files generated from each other before) for an embedded system. I wrote a little makefile deletin…
> each clearly defined step in makefile would turn into multiple unreadable function calls in cmake Utter nonsense. For most projects CMake is far more readable and maintainable than Makefiles. There's a reason it's the only build system even close to being a de facto standard in the C++ world. And yes, CMake is totally awful. But it's still slightly better than Make. (Feel free to post the Makefile!)
That's only true for pure C/C++ projects. (I haven't used cmake with other languages so i won't comment on that.). I was specifically talking about the project where there were 7-8 shell scripts to build each intermediate step's target.
When you have to call external commands to build your artifacts, you end up relying on:
add_custom_target()/add_custom_command()/execute_process()/etc..
Example from that Makefile:
$(DISK_IMAGE): $(PARTITION_LAYOUT) $(BOOT_IMAGE) $(SYSTEM_IMAGE) $(HOME_IMAGE)
$(info "~~~~~ Creating disk image ~~~~~")
$(eval PARTITION_LAYOUT_BOOT_START:=$(shell grep boot $(PARTITION_LAYOUT) | grep -oP 'start=\s*\K(\d+)'))
$(eval PARTITION_LAYOUT_SYSTEM_START:=$(shell grep root $(PARTITION_LAYOUT) | grep -oP 'start=\s*\K(\d+)'))
$(eval PARTITION_LAYOUT_HOME_START:=$(shell grep home $(PARTITION_LAYOUT) | grep -oP 'start=\s\*\K(\d+)'))
dd status=none if=/dev/zero of=$(DISK_IMAGE) bs=1M count=2000
sfdisk $(DISK_IMAGE)
When you toss in other variables, cmake becomes a lot more verbose/less readable for these kind of use cases.
Other steps in that Makefile were about generating, signing, verifying each of the partition images, fetching keys from the servers etc.. That whole Makefile was 500+ lines, and pretty sure in cmake it would have been lot longer.