https://github.com/onurozuduru/cpp-project-template
Project template for C++ with CMake, Gtest and a build script
https://github.com/onurozuduru/cpp-project-template
cpp project-template
Last synced: 15 days ago
JSON representation
Project template for C++ with CMake, Gtest and a build script
- Host: GitHub
- URL: https://github.com/onurozuduru/cpp-project-template
- Owner: onurozuduru
- License: mit
- Created: 2024-02-13T19:34:03.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2024-12-30T20:23:18.000Z (over 1 year ago)
- Last Synced: 2025-02-26T11:37:15.887Z (over 1 year ago)
- Topics: cpp, project-template
- Language: Shell
- Homepage:
- Size: 10.7 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# cpp-project-template
Project template for c++, includes a build script, example cmake files and [googletest](https://github.com/google/googletest) setup.

## Create New Project
`create_cpp_project.sh` copies the template to the given path and sets project name in cmake file.
It is possible to create link to the script under a directory under `$PATH`, by default `$HOME/.local/bin` is used.
```bash
# Give execute permission
chmod +x create_cpp_project
# Link script under ~/.local/bin for convenience
./create_cpp_project.sh --install
# Create new project
create_cpp_project /path/to/new_project
```
## Run Devcontainer from Terminal
```bash
.devcontainer/start_with_devcontainer_cli.sh
```
## Template Structure
```bash
TemplateProject/
├── .clang-format
├── .clang-tidy
├── .clangd
├── .devcontainer
│ ├── Dockerfile
│ ├── devcontainer.json
│ └── start_with_devcontainer_cli.sh
├── .gersemirc
├── .gitignore
├── CMakeLists.txt
├── build.sh
├── exe
│ ├── CMakeLists.txt
│ ├── include
│ │ └── logger.h
│ └── source
│ ├── logger.cpp
│ └── main.cpp
├── libs
│ ├── CMakeLists.txt
│ └── examplelib
│ ├── CMakeLists.txt
│ ├── include
│ │ └── examplelib.h
│ └── source
│ └── examplelib.cpp
└── test
├── CMakeLists.txt
├── libs
│ ├── CMakeLists.txt
│ └── examplelib
│ └── examplelib_test.cpp
└── mocks
├── CMakeLists.txt
└── examplelibmock.hpp
```
## Project Build Script
Each new project includes `build.sh` script to be able to build with CMake.
The script creates a folder named `build` under the project folder and able pass build type and build with or without tests.