Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tarcisioe/cpp-template
A cookiecutter template for C++ projects.
https://github.com/tarcisioe/cpp-template
conan cookiecutter-template
Last synced: 4 months ago
JSON representation
A cookiecutter template for C++ projects.
- Host: GitHub
- URL: https://github.com/tarcisioe/cpp-template
- Owner: tarcisioe
- License: other
- Created: 2020-03-17T06:49:11.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2021-08-14T23:28:30.000Z (over 3 years ago)
- Last Synced: 2024-09-27T06:42:19.936Z (4 months ago)
- Topics: conan, cookiecutter-template
- Language: CMake
- Size: 22.5 KB
- Stars: 15
- Watchers: 1
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
C++ Cookiecutter Template
=========================This is a [cookiecutter](https://github.com/cookiecutter/cookiecutter) template
for a C++ project using [CMake](https://cmake.org) and [Conan](conan.io). It
is heavily influenced by a [similar project by Jason
Turner](https://github.com/lefticus/cpp_starter_project). The main differences
are:- This is a cookiecutter template.
- This has no sample code other than an empty `main.cpp`.
- This has no default libraries already defined as dependencies.How to use
==========First, setup your own project with `cookiecutter`:
```bash
cookiecutter gh:tarcisioe/cpp-template
```This will create a directory with the name you defined in `project_slug`.
Enter that directory, then define the dependencies you wish to download and
build with `conan` in `CMakeLists.txt` by uncommenting `PACKAGES` and listing
them right after that:```cmake
conan(
PACKAGES
fmt/0.6.10
)
```Finally, create your build directory:
```bash
cmake -B build
```To link your dependencies, add them to your targets (e.g. `main` in
`src/CMakeLists.txt`) like this:```cmake
target_link_libraries(
main
PUBLIC
(...)
CONAN_PKG::fmt
)
```Then, build your project:
```bash
cmake --build build
```Enjoy your project with your dependencies, a compile database already generated,
warnings enabled, etc. :)