/CXXTemplate

A starting point for a new CMake-based C++ project.

Primary LanguageCMakeMIT LicenseMIT

CXXTemplate

A starting point for a new CMake-based C++ project.

Table of Contents

Dependencies

The following dependencies are mandatory:

  • C++ compiler
  • CMake (3.12 or greater)

The following dependencies are optional:

Building

Example snippet for building this project:

mkdir build && cd build
cmake -DCMAKE_INSTALL_PREFIX="/apps/CXXTemplate/" ..
cmake --build  . -- VERBOSE=1 -j8 all test install

CMake options for configuring this project:

CMake Variable name Description Default
BUILD_TESTING Enable automated testing. OFF
BUILD_DOCUMENTATION Build documentation. OFF

Template usage

To use this template:

  1. Create a new repository using CXXTemplate as the selected template project.
  2. Replace occurances of "CXXTemplate" with the new project name:
find . -name ".git" -prune -o -type f -exec sed -i "s/CXXTemplate/YOUR_PROJECT_NAME/g" {} +
  1. Remove any un-wanted source directories or files (such as the example library and programs under src/).

Convenience functions and macros are available to build libraries, documentation, programs, tests, or export the project:

See cmake/macros for available tools.