Project template for building C++ and C projects with CMake and various different compilers and IDEs. Install CMake first.
All builds displayed here are for Debug configurations. To build for release, replace
Debug
with Release
in the folder names and and add -DCMAKE_BUILD_TYPE=Release
to the CMake build command.
Install MSYS2 first. All command line steps here were done in MinGW64. Set up MinGW64:
pacman -Syuu
pacman -S git mingw-w64-x86_64-toolchain mingw-w64-x86_64-cmake
git config --global core.autocrlf true
Then build the application with
mkdir build-MinGW64 && cd build-MinGW64
cmake -G "MinGW Makefiles" ..
cmake --build . -j
Make sure you can build the application with MinGW64 like specified above. After that there are good instructions on how to set up Visual Studio Code here. A workspace file is provided as well to get started quickly.
Copy the .project
and .cproject
file found in misc/eclipse
into the project root
and open the folder in Eclipse with Open Project from Filesystem
. Build configurations and
launch files for MinGW were provided. You have to generate the build system with CMake via
command line first before you can Build, Run and Debug with Eclipse.
Install Visual Studio. You can generate Visual Studio project files with the following command (here, for Visual Studio 2019)
mkdir Debug-VS2019
cd Debug-VS2019
cmake .. -G "Visual Studio 16 2019"
After that, a .sln
project file is generated which you can open with Visual Studio 2019.
Instructions can be found here. Not tested yet.
Install LLVM first. Perform the same set-up as specified above for MinGW64.
Ensure you can call clang --version
from the command line by adding the LLVM binary path
to the MinGW64 path as well, for example by adding the following line in the ~/.bashrc
file
export PATH=$PATH:"/c/Program Files/LLVM/bin"
If everything was set up correctly, you can build the application with clang
mkdir build-MinGW64 && cd build-MinGW64
cmake -G "MinGW Makefiles" -DUSE_LLVM=ON ..
cmake --build . -j
Instructions for Ubuntu, adapt accordingly Install required packages and tools first
sudo apt-get update
sudo apt-get install build-essential gdb
Build the project like this:
mkdir Debug-Unix
cd Debug-Unix
cmake ..
cmake --build . -j
There are two Eclipse files .project
and .cproject
located inside the misc/eclipse
folder.
IN the .project
file, change the name to your project folder name. After that, copy both files
into the project root and open the folder in Eclipse with Open Project from Filesystem
. Build
configurations and launch files for Unix systems were provided. You have to generate the build
system with CMake via command line first before you can Build, Run and Debug with Eclipse.
Make sure you can build the application like specified above. After that there are good instructions on how to set up Visual Studio Code here
Install LLVM first.
If everything was set up correctly, you can build the application with clang
mkdir build && cd build
cmake -DUSE_LLVM=ON ..
cmake --build . -j