This repository contains a CMake template, intended to quickly setup your lab projects, for the Politecnico di Torino courses APA (deprecated), Tecniche di Programmazione, Algoritmi e Strutture Dati.
It is intended to be used with CLion, but if you feel brave you can use it without a GUI, or with VSCode.
It's compatible with Linux, Windows and Mac
- Quick setup
- Build/Run all the lab's exercises configurations inside your IDE
- Import files via relative path
- Download this project on your machine (git clone or download zip)
- Rename the main folder as your Lab name (e.g. L01 for lab1)
- (optional) open it in CLion - If you opened it in CLion, set up your standard CMake configuration
- Create a copy of the
EZZ
directory for every exercise. Rename it as the exercise name (e.g. E01 for ex.1) - Edit CMakeLists.txt:
- Inside each exercise folder:
This is automatic! Every time you build your exercise executable, CMake magic copies your .c, .h and text files in the
folder [projectName]_export/[ExerciseName]/
, ready to be copy-pasted and delivered!
note The changes occur only when you build the project!
This template tries to offer a quick solution for a very common problem: when opening a file, usually a lot of people
tries to open it using its relative path (e.g. ./file.txt
). This causes problems since the executable, when built,
usually looks for its relative path and doesn't find it, sinche the file itself doesn't get copied.
The "standard" solution is to include the full path (e.g. C:\user\develop\file.txt
).
With this template CMake copies the files inside the build folder: this enables you to open your files using relative path. To do so, you need to add the relative path (starting from the main.c location!) of the file to the exercises CMakeLists.txt.
It is recommended to add your files (also *.c and *h) into the same folder as your main.c !
Submit a new issue
Submit a pull request