Skip to content

Template for reliable, cross-platform C++ project setup using cmake.

License

Notifications You must be signed in to change notification settings

pbn4/cmake-init

 
 

Repository files navigation

C++ CMake Project Template

cmake-init is a copy and paste template, that provides the following features:

  • Cross Platform
  • Windows
  • Linux
  • Mac
  • Libraries, Applications, Testing template
  • Documentation template
  • Installation, Packaging template
  • CMake find script template for defined libraries

The files of cmake-init are an instantiation of the templates containing:

  • Example app
  • Example lib
  • Example test
  • Example documentation
  • Example package
Service System Compiler Status
Travis-CI Ubuntu 14.04 GCC 4.8, Clang 3.5 Build Status
Travis-CI macOS AppleClang 7.3 Build Status
AppVeyor Windows MSVC 2013
MSVC 2015
MSVC 2017
Build status
Jenkins



Ubuntu 14.04



GCC 4.7
GCC 4.8
GCC 4.9
GCC 5.4
Clang 3.8
Build Status
Build Status
Build Status
Build Status
Build Status
Jenkins

Windows 10

MSVC 2013 Update 5
MSVC 2015 Update 1
Build Status
Build Status
Jenkins OS X 10.10 AppleClang 6.0 Build Status

Please note that our OS X build node is currently broken (physically). However, cmake-init is supported and maintained for OS X as well.

Design Decisions

ToDo: revisit!

Console vs. Windows App (Windows only)

decisions:

  • we do not use the msvc subsystem linker flag
  • we do not use the add_executable win32 property
  • instead the set_target_properties with the WIN32_EXECUTABLE flag on target executable is used
  • we use the same subsystem for all configurations of a single target (no switching between, e.g., debug and release)

rationale: typically, only released 'feature' applications are required to decide on their subsystem, and in the case of 'gui-heavy' applications the windows subsystem is preferred (since the std output is probably piped into widgets, logfiles, or even discard).

furthermore, console output is usually more relevant for development/debugging purposes, already using console or IDE with appropriate console output handling

ToDo: Add missing content, bring into markdown form

Scenarios covered in cmake-init:

  1. Development

The project is contained in a source directory for active development.

binaries: ./build rpath: absolute paths to all dependencies datapath: ..

  1. Installation (default)

The project is installed in a self-contained directory, ready for being moved or copied to another location or computer.

binaries: ./bin rpath: $ORIGIN/../lib datapath: ..

  1. Installation (unix system install)

The project is installed globally on a system.

binaries: /usr/[local/]bin rpath: empty datapath: /usr/[local/]share/

About

Template for reliable, cross-platform C++ project setup using cmake.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 84.1%
  • Python 11.1%
  • CMake 2.2%
  • Shell 0.9%
  • Makefile 0.7%
  • M4 0.6%
  • C 0.4%