For completing this course you need to have installed on your machine:
CMake
- Any c++ compiler
- A text editor(an IDE is recommended)
Windows Subsystem for Linux
(WSL).
Once it has been installed correctly simply follow the instructions for linux.
It may be better to use a text editor to follow the hands on, then I suggest you to see these instructions to run graphical applications on WSL.
- Get the c++ compiler, open a terminal and type:
$ sudo apt-get install build-essential
- Get
cmake
:
$ sudo apt-get install cmake
- Get
cmake
gui(optional but highly recommended):
$ sudo apt-get install cmake-curses-gui
- Get the text editor(optional but highly recommended):
$ sudo apt-get install geany
Actually you can install the whatever text editor you like (e.g. kate
, gedit
, nano
, vim
, atom
, vs-code
).
The hands-on consist in the compilation of a simple executable that given 2 numbers (15 and 10), calculate the sum and the differece. Follow these steps:
- Open the
CMakeLists.txt
and fill all the TODO sections, following the teacher instructions. - Once finished and saved create the build directory:
$ mkdir build
- Enter in the build directory:
$ cd build
- Configure and generate the makefiles:
$ cmake ..
- Compile your program:
$ make
- Run:
./myExecutable
The output should be:
Executable standalone example
The operators are: 15 and 10
The sum is: 25
The difference is: 5
if everything is fine you have to commit your work then:
$ git commit -am "My hands on works!"
$ git push origin master
ℹ This repository contains the material required for the training on basics of CMake.