Avatar ·

What is the difference between Makefile and CMake for building C++ code?

Hi everyone! I've just started learning C++ and am trying to figure out build tools. I have a simple project: main.cpp, some class myclass.cpp and myclass.h. Right now I'm compiling everything manually in the terminal:\n\ng++ -c myclass.cpp -o myclass.o\ng++ -c main.cpp -o main.o\ng++ main.o myclass.o -o myprogram\n\nThis is terribly inconvenient, especially when there are many files. Everyone talks about Makefile and CMake, but I don't understand the difference between them. Is Makefile something like a script for make where I manually write compilation commands? And is CMake the same thing but through some config file? Or are they completely different things? Which tool should a beginner learn? I'd appreciate an explanation with examples! I need to understand which one solves my project build problem more simply and efficiently. Thanks in advance.