Skip to content

XzoRit/cpp_starter

Repository files navigation

template for c++ projects

This folder contains the project structure. Clone this repository delete the .git folder rename the project folder to your project name.

build files

Boost.Build and CMake build files are available.

Boost.Build

build

# build and run all targets
b2
# build lib
b2 lib//lib_lib
# build/run tests of lib
b2 lib//test
# build app
b2 app//exe
# build/run app
b2 app//run
# if you want to use a different compiler
b2 toolset=gcc

CMake

CMake presets for gcc, clang and msvc are provided.

# configure
cmake --preset clang
# build
cmake --build --preset clang
# list all available targets
cmake --build --preset clang --target help
# test
ctest --preset clang
ctest --preset clang -R 'app::exe'
ctest --preset clang -R 'lib::test'

formatting

Clang-Format file is available.

# recursively format all source files
find ./ -type f -name '*.?pp' -exec clang-format -i {} \;

cmake-format configuration

see cmake-format

# recursively format all cmake files
find . -type f -name 'CMakeLists.txt' -execdir cmake-format -i {} \;

compile_comand.json

cmake is configured to produce a compile_comand.json. Most tools expect it to be in the root directory of the project. This is achieved by creating a link e.g.:

# assumes . is project root and
# cmake generated the build files into the folder named 'build'
ln -s build/clang/compile_commands.json

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published