This repository represents a generic CMake template for CPP and C programs and libraries.
To build programs, create a subfolder in the ./src/programs/
folder. The name of this subfolder represents the executable name.
All h files in the include
subfolder and all c
and cpp
files in the program folder are added as project dependencies and are watched for changes.
To build libraries, create a subfolder in the /src/llibraries/
folder. The name of this subfolder represents the library name.
All h files in the include
subfolder and all c
and cpp
files in the program folder are added as project dependencies and are watched for changes.
To manage dependencies in the program and library folders, you have to create a deps.txt file can be created. The dependencies should be added line by line.
If a line matches the exact name of a library within the same project, this library is used as dependency and include path is added. Otherwise, the CMake capability is used to find the library within your system and is added as an external dependency.
This template also supports testing. At the moment, there are to type of supported tests.
If you create a subfolder in tests/criterion/
the files in there are build to a criterion test. These tests are automatically linked to the libCriterion
library, which must be existent in your system. Dependency handling is done in the same way as it is done for regular programs and libraries.
You can create subfolders in /tests/io_tests/
. These subfolders must match the name of a program you have created within the project. The tests fail, if the program is not yet build. You can implement multiple IO-Tests for a single executable, by adding <xx>.in
, <xx>.out
and <xx>.err
files (<xx>
is the matching test number, e.g. 01). If the program is implemented, every <xx>.in
file is applied to the program as stdin and the created stdout of the program is matched with the <xx>.out
file, as the created stderr is matched with the <xx>.err
. The tests fail if the outputs don't match the requirements.