This is a basic template to create a C/C++ project. Compilation process is handled by CMake.
- CMake
- A C/C++ compiler, this template has the intention to be cross platform. Check the
build.bat
file for a example of Visual Studio solution generator.
- Source files go inside
src/
. Put all header files on thesrc/include/
folder. - Go into the
CMakeLists.txt
file and change the project name. Include all your source files in this file. - If you want, you can also modify the internal static library or remove it from the project.
For GNU/Linux, use the usual commands:
mkdir build
cd build
cmake ..
make
To create a Visual Studio solution, you can use the build.bat
script:
@ECHO ON
RMDIR /Q /S build
MKDIR build
PUSHD build
cmake -G "Visual Studio 16" ..
This script will compile a VS 2019 solution, replace 16 for other versions.
The template provides an example for unit testing the static library. To run the tests, you can manually execute them from the bin/ut
folder, or you can use CTest
from the build/
folder.
The executable for the program and the unit tests will be in the bin/
folder. The library is being saved in the bin/libs
folder.
- Add optional code coverage analysis
- Verify that the project is ready to use out-of-the-box with CI/CD tools.