Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
Because you have to learn a config instead of just writing what should be compiled by which commands.
Makefile ftw. -
Avyy7494y@nitwhiz cmake can write those commands for me, that too with cross platform suppprt. Plus I find cmake more readable than make
The last line is a personal opinion. I've been using make for years, and readability drops with the number of files in source. I still use make for smaller builds -
@AvyChanna genuine interest: does cmake limit you to gcc/g++ or could you wrap other tasks (say docker run, rm -rf, unzip, whatever) with it?
Does cmake even work like make, as in you call cmake <target> or does it solely work with compilers on source files? -
@nitwhiz If every compiler would take the same flags, headers and libraries are always at the same location (and installed) and every platform would behave the same, then yes, makefiles would be superior. But on fortunately this isn't the case and my software should work on BSDs, Linux and Windows without 5 different make files.
-
Avyy7494y@nitwhiz cmake initiates your actual build. On linux, it will generate a makefile. On windows, it will make a VS sln project. You can add custom outputs/commands for building, or even prebiild/postbuild.
Basically, you call cmake to make a makefile, and then you run that makefile manually to get the desired result(and it has targets like all/build/clean/install/your custom targets)
Edit: You dont need to add flags. You just specify libname and it automatically links to it. -
@matt-jd Huh? Do you mind giving an example, especially for Windows/Linux compatibility? Visual studio (which is the most used compiler on Windows) is "a bit" different and I would generally like to write a build instruction that works compiler agnostic (extra work for very specific things like hardening flags are okay).
How do I do "header testing", e.g. if a functionality can be in one or more headers at different locations? -
@nitwhiz Yes to all of that. You can do anything with cmake, depending on how much energy you have.
Related Rants
-
DrPenguin9!rant Some days ago I finished "Ray tracing in a weekend" (Peter Shirley) and I'm learning a lot :D In the n...
-
pps839In 15+ years of full time work as a C++ software engineer there is one tool that I always hated: CMAKE. What a...
-
Hastouki2This bonehead wants to delete your C++ code. He obviously means that to use this for out-of-source builds, but...
Today I fell in love with cmake. Dunno why everybody hates it.
random
cmake