https://github.com/feglawy/cpp_template
C++ project template with CMake and GoogleTest integration for building and testing libraries, ensuring code quality and maintainability.
https://github.com/feglawy/cpp_template
cmake cpp cpp17 gtest template template-project
Last synced: 4 months ago
JSON representation
C++ project template with CMake and GoogleTest integration for building and testing libraries, ensuring code quality and maintainability.
- Host: GitHub
- URL: https://github.com/feglawy/cpp_template
- Owner: Feglawy
- License: unlicense
- Created: 2024-10-10T21:19:14.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-12-01T15:10:06.000Z (over 1 year ago)
- Last Synced: 2025-04-01T03:51:16.818Z (about 1 year ago)
- Topics: cmake, cpp, cpp17, gtest, template, template-project
- Language: CMake
- Homepage:
- Size: 43 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# C++ Project Template
This project template is designed to help you set up a C++ 17 project using CMake. The template is minimal yet flexible, allowing you to add libraries and expand your project as needed.
## Project Structure
The structure of the project is as follows:
```structure
πProject
βββ πbuild # Build directory created after running CMake (contains generated build files)
βββ πcmake # Directory for CMake scripts
βββ Conan.cmake # Script for managing external dependencies using Conan package manager
βββ config.cmake # CMake configuration settings (e.g., compiler flags, environment variables)
βββ FetchGoogleTest.cmake # CMake script to fetch GoogleTest dependency
βββ Libraries.cmake # CMake script for handling libraries configurations
βββ πdata # Directory for storing data files and other resources
βββ πdocs # Documentation files for the project
βββ πinclude # Directory for header files
βββ πlibrary # Optional subdirectory for library header files
βββ conf.hpp # Example header file, potentially for project-wide configurations
βββ πsrc # Directory for source code files
βββ πlibrary # Optional subdirectory for library source files
βββ CMakeLists.txt # CMake configuration for building the source code files
βββ main.cpp # Main program file where the entry point (main function) resides
βββ πtests # Directory for test files
βββ CMakeLists.txt # CMake configuration for compiling and running tests
βββ test_main.cc # Main test file for the project, typically where tests are executed
βββ CMAKELISTS.txt # Top-level CMake build configuration file for the project
```
### Key Folders
- `include/`: Contains all your header files (.hpp). You can organize headers for different libraries into subdirectories within include/library/ if necessary.
- `src/`: Contains all your source files (.cpp). You can organize source files for different libraries into subdirectories within src/library/
- `cmake/`: This directory can store additional CMake configuration files.
- `tests/`: (Optional) Contains all test files.
- `data/` : Store resources and data files in this direcotry.
## How to Configure and Build the Project
See **[Building and Running the project](./docs/Building_and_Running_the_Project.md)**
> [!NOTE]
> You can use cmake extension in vscode for building and running the project it gets the job done.
## To customize the CMake Configurations
See **[Configure CMake for your project](./docs/CMake_Configuration.md)**
### Handling your libraries
See **[adding libraries](./docs/CMake_Configuration.md#add-more-libraries)**