https://github.com/cblichmann/cxx-project-template
A modern C++ project template
https://github.com/cblichmann/cxx-project-template
Last synced: 4 months ago
JSON representation
A modern C++ project template
- Host: GitHub
- URL: https://github.com/cblichmann/cxx-project-template
- Owner: cblichmann
- License: other
- Created: 2021-02-17T13:22:14.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2021-02-17T13:45:16.000Z (over 5 years ago)
- Last Synced: 2025-10-09T12:08:53.891Z (9 months ago)
- Language: CMake
- Size: 7.81 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Modern CMake template for C/C++ projects
Features:
- Superbuild for dependencies, using `ExternalProject_add`
- Base target that sets build properties
- Example dependencies: Abseil, Google Test
## Configure/Build
### Linux
Default "Makefile" generator does not have the concept of build configurations
that can be selected at build invocation time.
Instead one needs to specify the build type explicitly ("Release", "Debug",
etc.).
```bash
mkdir -p build && cd build
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_RULE_MESSAGES=OFF
cmake --build . -- -j$(nproc)
```
Note: Everything after the `--` in the build command above gets passed to Make
and runs a parallel build on all available (logical) CPUs.
### macOS
On macOS, the XCode generator can be used that allows to select the build
configuration as build invocation time. Builds are always run in parallel.
```bash
mkdir -p build && cd build
cmake .. -G "XCode"
cmake --build . --config Release
```
### Windows
The Visual Studio generator uses MSBuild by default and allows to select the
build configuration at build invocation time.
```dos
if not exist build mkdir build
cd build
cmake .. -G "Visual Studio 15 2017 Win64"
cmake --build . --config Release -- /m /clp:NoSummary;ForceNoAlign /v:minimal
```
Everything after the `--` in the build command above gets passed to MSBuild and
ensures proper multi-core builds and sensible build output.