If you already have a compiler installed, you can go from nothing to knowing how to build a library, executable and an installer for multiple platforms in just a couple of hours with the CMake tutorial: https://cmake.org/cmake-tutorial/
If you already have a compiler installed, you can go from nothing to knowing how to build a library, executable and an installer for multiple platforms in just a couple of hours with the CMake tutorial: https://cmake.org/cmake-tutorial/
If I want to use an external library in a C++ project, I need to:
* download it from the website / GitHub
* build it from source
* add the library into my CMake file.
Whereas in Gradle, I add a single line to one file and the library is installed on my next build attempt. Full stop. There are no more steps.
C++ makes it searingly painful to get a project going. I'm honestly afraid to add any new libraries to my projects because I know that (at minimum) that means I'm sacrificing an afternoon to resolving new errors.
That you have to compile anything yourself is a byproduct of the fact that different platforms have different ABIs, combined with the lack of proper package management on platforms like Windows.
What I find the most enervating about CMake is that somehow everyone agreed (at least to some degree) to use the worst cross-platform build tool in existence. Instead of a build system based on solid principles we got a "hack your own build" starter kit in which you have to look for dependencies yourself ^1 combined with a build script language that is worse than the languages it set out to replace. How can anyone honestly be happy when switching from makefiles to this monstrosity?
^1 And no, the FindX scripts never work properly everywhere.
I have been in places where demanding python just wouldn't work. Either a specific version was needed for something else and managing the dependencies was a pain or we were already reliant on other scripting languages. I think this kills any other language as a build tool.
There are zealots for every IDE and some IDEs require special project files. If your build system doesn't seamlessly integrate most then it couldn't have made it. Scons never worked with IDEs I liked, Know how to get it cowkring with QtCreator? Other will demand vs2015r3 integration, how do you do that?
Then then there are the build systems you didn't mention, but the minimalistic ones. There was even one that was entirely stateless, but it was also too inflexible for most real builds.
CMake very carefully walked a thin line that dodged all these issues and the fact it is a giant pile of global mutable shared state simply doesn't for all but the largest builds.
Really? I feel the opposite. At least when I write makefiles by hand I understand them fully.
Cmake just confuses me, I'm not sure it's such and improvement.
- automatically collects executables to build from the .cpp files in two distinct directories
- uses the CPP preprocessor to only link in the object files in the rest of the project associated to headers used directly or indirectly by the executable .cpp files
- allows me to select the compiler using an environment variable
- allows me to pre-define some common options for the three supported compilers (e.g. to disable specific warnings with ICPC and increase the template instantiation depth for Clang)
- allows me to specify whether I want to rebuild everything or just a single executable and whether this should be copied into the external directory contained in my $PATH
Yes, putting this together was a bit of work (208 lines for the Makefile, 34 for the dependency generator and 15 for the script which puts the current output of `git diff` into a CPP #define), but now it only rebuilds the things needed, only links in the object files needed and allows me to quickly test multiple compilers. Getting all this with CMake seemed extremely difficult when I last looked at it.
Addendum: I should add that my only external dependency is Boost and LAPACK and I essentially ask the user to point me at their Boost base directory and plug in their LAPACK link line -- this works well for the target audience (fellow physicists who are used to all sorts of horrible toolkit installation processes), but I understand it may be annoying to the more general public (or if you have more external dependencies).
Do you mean that you, then, have to rebuild your project from scratch?