

A large problem with CMake is that there are many tutorials giving bad advice, including its own documentation. it can output MSBuild files for Visual Studio when used on Windows, but can also output makefiles when used on Linux.ĬMake works by reading a single input file named CMakeLists.txt and generating platform-specific files for different build systems from the declarations and commands within. What this means is that CMake does not build things, it generates files for other build systems to use. CMakeĬMake is cross-platform meta build-system. It is important to note that these tutorials are not meant to build a bottom-up understanding of either of the two, but rather provide a person with an easy-to-modify template that they can use for themselves and quickly get back to the interesting part - their code.

Their exact contents do not matter, but main.cpp includes vector.hpp, vector.cpp includes array.hpp and both vector.cpp and array.cpp include their respective headers, vector.hpp and array.hpp. It is start of an implementation of growing array (ala std::vector), consisting of 5 files: Through these tutorials, I'll use a very simple example from one of our labs. This is the CMake tutorial, the Make one can be found here. After seeing the same errors repeated over and over again, I decided to write a short tutorial towards writing simple Makefiles and CMakeLists. The end of a semester is here and, as I grade our student's semestral works, I get to use Makefiles and CMakeLists of dubious quality. By Martin Hořeňovský May 20th 2018 Tags: CMake, Tutorial, C++
