Skip to content
/ cmake-init Public template

A template that automates creation of a cpp project

License

Notifications You must be signed in to change notification settings

Kushal-Chandar/cmake-init

Repository files navigation

cmake-init

c++ cmake

a cmake project with ci, code coverage, clang tidy, cpp check, graphviz, iwyu, gtest, etc.

dependency management -> vcpkg

Features

  • Automatic versioning with git annotated tags, please follow semantic versioning for accurate and predictable results.
  • Custom project variables.
# -----------------------------------------------------------------------------------
#   Setting custom variables
# if your project name is cmake-init
# CMAKE_INIT_PUBLIC_HEADER_DIR variable -> public headers (include/${PROJECT_NAME})
# CMAKE_INIT_PRIVATE_HEADER_DIR variable -> private headers (src/inc)
# CMAKE_INIT_SOURCE_DIR variable -> source files (src)
# CMAKE_INIT_IMPL_DIR variable -> implementation (src/impl)
# CMAKE_INIT_TEST_DIR variable -> implementation (test)
# -----------------------------------------------------------------------------------
  • Easy to use project structure.
cmake-init
 ├── include
 │   └── cmake-init
 │       └── cmake_init.h
 ├── src
 │   ├── config
 │   │   ├── config.h
 │   │   └── config.h.ini
 │   ├── inc
 │   │   ├── cmake_init
 │   │   │   ├── print_greeting.h
 │   │   │   └── CMakeLists.txt
 │   │   ├── cli.h
 │   │   └── CMakeLists.txt
 │   └── impl
 │       ├── cmake_init
 │       │   ├── print_greeting.h
 │       │   └── CMakeLists.txt
 │       ├── cmake_init.cc
 │       ├── cli.cc
 │       ├── main.cc
 │       └── CMakeLists.txt
 ├── tests
 │   ├── cmake_init
 │   │   ├── print_greeting_test.h
 │   │   └── CMakeLists.txt
 │   ├── cmake_init_test.cc
 │   ├── cli_test.cc
 │   ├── main_test.cc
 │   └── CMakeLists.txt
 └── CMakeLists.txt
  • CMakeLists.txt file in every directory lets you sources easily to your target without any prefixing (Please read the comments in CMakeLists.txt files for a better understanding).

Usage

Make sure you have base development packages for your environment.

You will need cmake, git, etc (some other requirements for vcpkg)

Open options.cmake to tweak some settings.

mkdir build && cd build
cmake -S .. -B .

NOTE

This template uses MIT License. Please feel free to change this to your intended license before publishing the software.

Todo in CI

Static analysis -> markdownlint, clang-tidy, cppcheck, iwyu Formatting -> clang-format, cmake-format (todo add ci) Sanitizer -> Clang sanitizers

todo -> testing, actions testing -> code coverage in github actions actions -> github actions

Goals

make an executable or a vscode extension to generate a project

About

A template that automates creation of a cpp project

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published