Skip to content

Repository files navigation

C/C++ Project Template

Overview

A template repository for C/C++ projects with CMake and Conan. A GitHub Action workflow is provided with the on workflow_dispatch event. This event has three input parameters which are language, type, and namespace. language is the language the project will be generated in. As the name of this template repo might suggest, the only available options are C and C++. For type, one can choose from Executable, Static Library, Shared Library, or Interface Library. The last parameter, namespace, is optional and defaults to the name of the GitHub repository name.

Template Parameters: language

language is the language the template will be generated in. As the name of this template repository might suggest, the only available options are C and C++

Template Parameters: type

type determines how the project will be generated. The supported types are Executable, Static Library, Shared Library, and Interface Library.

Project Types: Executable

C Executable Project File Tree

.
├── src/
│   ├── CMakeLists.txt
│   └── <project_name>.c
├── test_package/
│   ├── src/
│   │   ├── CMakeLists.txt
│   │   └── main.c
│   ├── CMakeLists.txt
│   └── conanfile.py
├── tests/
│   ├── CMakeLists.txt
│   └── <project_name>_test.cpp
├── .clang-format
├── .clang-tidy
├── .gitignore
├── CMakeLists.txt
├── conanfile.py
├── LICENSE
└── README.md

C++ Executable Project File Tree

.
├── src/
│   ├── CMakeLists.txt
│   └── <project_name>.cpp
├── test_package/
│   ├── src/
│   │   ├── CMakeLists.txt
│   │   └── main.cpp
│   ├── CMakeLists.txt
│   └── conanfile.py
├── tests/
│   ├── CMakeLists.txt
│   └── <project_name>_test.cpp
├── .clang-format
├── .clang-tidy
├── .gitignore
├── CMakeLists.txt
├── conanfile.py
├── LICENSE
└── README.md

Project Types: Static Library

C Static Project File Tree

.
├── include/
│   └── <project_namespace>/
│       ├── <project_name>.h
│       └── export.h
├── src/
│   ├── CMakeLists.txt
│   └── <project_name>.c
├── test_package/
│   ├── src/
│   │   ├── CMakeLists.txt
│   │   └── main.c
│   ├── CMakeLists.txt
│   └── conanfile.py
├── tests/
│   ├── CMakeLists.txt
│   └── <project_name>_test.cpp
├── .clang-format
├── .clang-tidy
├── .gitignore
├── CMakeLists.txt
├── conanfile.py
├── LICENSE
└── README.md

C++ Static Project File Tree

.
├── include/
│   └── <project_namespace>/
│       ├── <project_name>.hpp
│       └── export.hpp
├── src/
│   ├── CMakeLists.txt
│   └── <project_name>.cpp
├── test_package/
│   ├── src/
│   │   ├── CMakeLists.txt
│   │   └── main.cpp
│   ├── CMakeLists.txt
│   └── conanfile.py
├── tests/
│   ├── CMakeLists.txt
│   └── <project_name>_test.cpp
├── .clang-format
├── .clang-tidy
├── .gitignore
├── CMakeLists.txt
├── conanfile.py
├── LICENSE
└── README.md

Project Types: Shared Library

C Shared Library Project File Tree

.
├── include/
│   └── <project_namespace>/
│       ├── <project_name>.h
│       └── export.h
├── src/
│   ├── CMakeLists.txt
│   └── <project_name>.c
├── test_package/
│   ├── src/
│   │   ├── CMakeLists.txt
│   │   └── main.c
│   ├── CMakeLists.txt
│   └── conanfile.py
├── tests/
│   ├── CMakeLists.txt
│   └── <project_name>_test.cpp
├── .clang-format
├── .clang-tidy
├── .gitignore
├── CMakeLists.txt
├── conanfile.py
├── LICENSE
└── README.md

C++ Shared Library Project File Tree

.
├── include/
│   └── <project_namespace>/
│       ├── <project_name>.hpp
│       └── export.hpp
├── src/
│   ├── CMakeLists.txt
│   └── <project_name>.cpp
├── test_package/
│   ├── src/
│   │   ├── CMakeLists.txt
│   │   └── main.cpp
│   ├── CMakeLists.txt
│   └── conanfile.py
├── tests/
│   ├── CMakeLists.txt
│   └── <project_name>_test.cpp
├── .clang-format
├── .clang-tidy
├── .gitignore
├── CMakeLists.txt
├── conanfile.py
├── LICENSE
└── README.md

Project Types: Interface Library

C Interface Library Project File Tree

.
├── include/
│   └── <project_namespace>/
│       └── <project_name>.h
├── test_package/
│   ├── src/
│   │   ├── CMakeLists.txt
│   │   └── main.c
│   ├── CMakeLists.txt
│   └── conanfile.py
├── tests/
│   ├── CMakeLists.txt
│   └── <project_name>_test.cpp
├── .clang-format
├── .clang-tidy
├── .gitignore
├── CMakeLists.txt
├── conanfile.py
├── LICENSE
└── README.md

C++ Interface Library Project File Tree

.
├── include/
│   └── <project_namespace>/
│       └── <project_name>.hpp
├── test_package/
│   ├── src/
│   │   ├── CMakeLists.txt
│   │   └── main.cpp
│   ├── CMakeLists.txt
│   └── conanfile.py
├── tests/
│   ├── CMakeLists.txt
│   └── <project_name>_test.cpp
├── .clang-format
├── .clang-tidy
├── .gitignore
├── CMakeLists.txt
├── conanfile.py
├── LICENSE
└── README.md

Template Parameters: namespace

The name that will be applied to CMake targets and is the name of the directory that all header files will be under. For example, if the namespace is my_namespace, then all CMake target will have the alias my_namespace::<target_name> where <target_name> is the name of the CMake target. Additionally, all header files will be stored in the directory <project_root>/include/my_namespace.

About

A C/C++ project template with CMake and Conan.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages