This is a template for c language within VSCode CMake Environment
CMake practice based on:
The requirements are:
- CMake 3.11 or better; 3.14+ highly recommended.
- A C++17 compatible compiler
- Git
-
Windows:
-
Linux (Ubuntu 20.04):
sudo apt update sudo apt upgrade sudo apt install cmake sudo apt install gcc sudo apt install g++ sudo apt install gdb
.
├── CMakeLists.txt # Root CMakeLists.txt
├── LICENSE
├── README.md # This file
├── apps # Application folder
│ ├── CMakeLists.txt # Application CMakeLists.txt
│ ├── inc # Application include folder
│ │ └── lib_calc.h # Application include file
│ ├── main.c # Application main file
│ ├── scripts # Application scripts folder
│ │ ├── helper.py # Application helper script
│ │ ├── killExes.bat # Application killExes script
│ │ └── killExes.sh # Application killExes script
│ ├── src # Application source folder
│ │ ├── CMakeLists.txt # Application source CMakeLists.txt
│ │ └── lib_calc.c # Application source file
│ └── test # Application test folder
│ ├── CMakeLists.txt # Application test CMakeLists.txt
│ └── test_lib_calc.cc # Application test file
├── doc # Documentation folder
│ └── basicStructure.txt # Basic folder structure
└── output # Output folder
├── exe # Output executable folder
│ ├── main # Output main executable folder
│ └── test # Output test executable folder
└── lib # Output library folder
└── libcalc.a # Output library file
To configure (in root folder):
mkdir build
cd build
cmake ..
To build (in build folder):
cmake --build .
To run (in output\exe\main folder):
./main.exe
To test (in output\exe\test folder):
./test_lib_XXX.exe