Concise CMake templates for creating C++ libraries or executables.

Overview

cmake_templates

Concise cmake templates for creating C++ libraries and executables.

Creating a normal cmake project

  • Copy the chosen project template somewhere.
  • Rename the folder include/PROJECT_NAME_HERE/.
  • Open CMakeLists.txt and change PROJECT_NAME_HERE.
#################################################    Project     #################################################
cmake_minimum_required(VERSION 3.2 FATAL_ERROR)
project               (PROJECT_NAME_HERE VERSION 1.0 LANGUAGES CXX)
list                  (APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
...
  • Add your third party libraries via the import_library function which creates a cmake library target for the given include directories and libraries. You may also set the PROJECT_INCLUDE_DIRS and PROJECT_LIBRARIES variables manually instead of using import_library.
...
#################################################  Dependencies  #################################################
include(import_library)

# ADD LIBRARIES HERE. EXAMPLES:
# Header Only:
find_package  (GLM REQUIRED)
import_library(GLM_INCLUDE_DIRS)
# Identical Debug and Release:
find_package  (OpenGL REQUIRED)
import_library(OPENGL_INCLUDE_DIR OPENGL_LIBRARIES)
# Separate Debug and Release:
find_package  (Boost REQUIRED iostreams)
import_library(Boost_INCLUDE_DIRS Boost_IOSTREAMS_LIBRARY_DEBUG Boost_IOSTREAMS_LIBRARY_RELEASE)
...

Creating a conan cmake project

  • Copy the chosen project template somewhere.
  • Rename the folder include/PROJECT_NAME_HERE/.
  • Open CMakeLists.txt and change PROJECT_NAME_HERE.
#################################################    Project     #################################################
cmake_minimum_required(VERSION 3.2 FATAL_ERROR)
project               (PROJECT_NAME_HERE VERSION 1.0 LANGUAGES CXX)
list                  (APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
...
  • Open conanfile.py, change PROJECT_NAME_HERE as well as PROJECT_URL_HERE (if available) and add your third party libraries to the requires.
...
class Project(ConanFile):
    name            = "PROJECT_NAME_HERE"
    description     = "Conan package for PROJECT_NAME_HERE."
    version         = "1.0.0"                
    url             = "PROJECT_URL_HERE"
    settings        = "arch", "build_type", "compiler", "os"
    generators      = "cmake"
    requires        = (("catch2/2.2.0@bincrafters/stable")) 
    ...

Creating a vcpkg cmake project

  • Copy the chosen project template somewhere.
  • Rename the folder include/PROJECT_NAME_HERE/.
  • Open CMakeLists.txt and change PROJECT_NAME_HERE.
#################################################    Project     #################################################
cmake_minimum_required(VERSION 3.2 FATAL_ERROR)
project               (PROJECT_NAME_HERE VERSION 1.0 LANGUAGES CXX)
list                  (APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
...
  • Add your third party libraries via the import_library function which creates a cmake library target for the given include directories and libraries. You may also set the PROJECT_INCLUDE_DIRS and PROJECT_LIBRARIES variables manually instead of using import_library.
...
#################################################  Dependencies  #################################################
include(import_library)

# ADD LIBRARIES HERE. EXAMPLES:
# Header Only:
find_package  (GLM REQUIRED)
import_library(GLM_INCLUDE_DIRS)
# Identical Debug and Release:
find_package  (OpenGL REQUIRED)
import_library(OPENGL_INCLUDE_DIR OPENGL_LIBRARIES)
# Separate Debug and Release:
find_package  (Boost REQUIRED iostreams)
import_library(Boost_INCLUDE_DIRS Boost_IOSTREAMS_LIBRARY_DEBUG Boost_IOSTREAMS_LIBRARY_RELEASE)
...
  • Open bootstrap.bat and bootstrap.sh, and add your third party library ports.
...
rem Add your library ports here.
%VCPKG_COMMAND% catch2
...
...
# Add your library ports here. 
$VCPKG_COMMAND catch2
...
You might also like...
POCO C++ Libraries are powerful cross-platform C++ libraries for building network
POCO C++ Libraries are powerful cross-platform C++ libraries for building network

The POCO C++ Libraries are powerful cross-platform C++ libraries for building network- and internet-based applications that run on desktop, server, mobile, IoT, and embedded systems.

Mustache text templates for modern C++

About Mustache implementation for modern C++ (requires C++11) Header only Zero dependencies Templated string type for compatibility with any STL-like

📚 C++ Templates 2ed 笔记:C++11/14/17 模板技术

📚 C++ Templates 2ed 笔记:C++11/14/17 模板技术

A modern compile-time reflection library for C++ with support for overloads, templates, attributes and proxies

refl-cpp v0.12.1 Documentation refl-cpp encodes type metadata in the type system to allow compile-time reflection via constexpr and template metaprogr

Templates, algorithms and data structures implemented and collected for programming contests.
Templates, algorithms and data structures implemented and collected for programming contests.

Templates, algorithms and data structures implemented and collected for programming contests.

URI Templates expansion and reverse-matching for C++

URI-template This library implements URI Template with full support up to Level 4 providing expansion and match capabilities. It requires c++17 compil

Variadic recursive expression templates which look like ordinary (possibly nested) containers.

Variadic resursive expressions with lazy evaluation which look like nested containers LazyExpression is a header-only library written in C++17. It imp

Blazing-fast Expression Templates Library (ETL) with GPU support, in C++

Expression Templates Library (ETL) 1.3.0 ETL is a header only library for C++ that provides vector and matrix classes with support for Expression Temp

C++ intrusive container templates. Abstract node links, no use of new/delete.

C-plus-plus-intrusive-container-templates C++ intrusive container templates. Abstract node links, no use of new/delete (AVL tree, singly-linked list,

010 Editor binary templates to open some newer Eurocom/EngineX formats.

gforce-tools 010 Editor binary templates to open some newer Eurocom/EngineX formats. https://sphinxandthecursedmummy.fandom.com/wiki/EngineX The Filel

CMake scripts for building OpenSceneGraph third party libraries.

osg-3rdparty-cmake CMake scripts for building OpenSceneGraph third party libraries. These scripts can be used to build third party libraries from sour

CMake BASIS makes it easy to create sharable software and libraries that work together

CMake BASIS makes it easy to create sharable software and libraries that work together. This is accomplished by combining and documenting some of the best practices and utilities available. This project supplies a fully integrated suite of functionality to make the whole process seamless!

CMake modules for some scientific libraries

A collection of CMake modules, which can mostly be used independently. The utilities for writing robust Find* modules might be useful until CMake take

📦 CMake's missing package manager. A small CMake script for setup-free, cross-platform, reproducible dependency management.
📦 CMake's missing package manager. A small CMake script for setup-free, cross-platform, reproducible dependency management.

Setup-free CMake dependency management CPM.cmake is a CMake script that adds dependency management capabilities to CMake. It's built as a thin wrapper

📦 CMake's missing package manager. A small CMake script for setup-free, cross-platform, reproducible dependency management.
📦 CMake's missing package manager. A small CMake script for setup-free, cross-platform, reproducible dependency management.

Setup-free CMake dependency management CPM.cmake is a CMake script that adds dependency management capabilities to CMake. It's built as a thin wrapper

Cmake-language-server - CMake LSP Implementation

cmake-language-server CMake LSP Implementation. Alpha Stage, work in progress. Features Builtin command completion Documentation for commands and vari

Cmake check - Static analysis for CMake files.
Cmake check - Static analysis for CMake files.

cmake_check Cmake_check is a linter for the CMake language. It takes a set of user-defined rules and reports violations for CMakeLists.txt files and C

CMake checks cache helper modules – for fast CI CMake builds!

cmake-checks-cache Cross platform CMake projects do platform introspection by the means of "Check" macros. Have a look at CMake's How To Write Platfor

CMake scripts for painless usage of SuiteSparse+METIS from Visual Studio and the rest of Windows/Linux/OSX IDEs supported by CMake

CMake scripts for painless usage of Tim Davis' SuiteSparse (CHOLMOD,UMFPACK,AMD,LDL,SPQR,...) and METIS from Visual Studio and the rest of Windows/Lin

Comments
  • Create a web service for automatic configuration.

    Create a web service for automatic configuration.

    The web page should request the following information from the user:

    • [ ] Project name
    • [ ] Project URL
    • [ ] Executable / Header-only Library / Library
    • [ ] Conan / Normal
    • [ ] Dependencies? (not trivial for normal configurations)

    The service should parse this information, configure the appropriate template, and compress it for download by the user.

    See http://kinolien.github.io/gitzip/ and https://minhaskamal.github.io/DownGit/#/home

    enhancement help wanted 
    opened by acdemiralp 0
Owner
Ali Can Demiralp
Ali Can Demiralp
A collection of std-like single-header C++ libraries

itlib: iboB's Template Libraries A collection of small single-header C++ libraries similar to or extending the C++ standard library. See below for a l

Borislav Stanimirov 98 Dec 29, 2022
A template C project using CMAKE, logging library and basic memory handling.

C Project template Aim of this Repository is to create a template repository for C executable projects with following properties: Cmake project Loggin

Aditya Singh Rathore 6 May 23, 2022
GNU Scientific Library with CMake build support and AMPL bindings

GSL - GNU Scientific Library This is GSL, the GNU Scientific Library, a collection of numerical routines for scientific computing. GSL is free softwar

AMPL 441 Dec 24, 2022
Basic jam templates using Handmade libraries to get up and running quickly.

This is a selection of template projects to get up and running with for the Wheel Reinvention Jam. They are built on top of Handmade-inspired librarie

Handmade Network 16 Nov 27, 2022
Functional Programming Library for C++. Write concise and readable C++ code.

FunctionalPlus helps you write concise and readable C++ code. Table of contents Introduction Usage examples Type deduction and useful error messages T

Tobias Hermann 1.7k Dec 29, 2022
MissionImpossible - A concise C++17 implementation of automatic differentiation (operator overloading)

Mission : Impossible (AutoDiff) Table of contents What is it? News Compilation Meson CMake Examples Jacobian example Complex number example Hessian ac

pixor 18 Oct 13, 2022
IDAShell is a shell extension for launching IDA from the context menu of executables.

IDAShell About IDAShell is a shell extension for launching IDA from the context menu of executables. Usage Just install and it works. If you moved IDA

null 174 Dec 18, 2022
Automatically load dlls into any executables without replacing any files!

Automatically loaded dll using xinput9_1_0 proxy. Please put the modified xinput9_1_0.dll in the executable's directory.

null 14 Dec 24, 2022
Feature-rich C99 library for memory scanning purposes, designed for Windows running machines, meant to work on both 32-bit and 64-bit portable executables. Has a modern C++ wrapper.

memscan Feature-rich C99 library for memory scanning purposes, designed for Windows running machines, meant to work on both 32-bit and 64-bit portable

cristei 15 Oct 2, 2022
Using shared memory to communicate between two executables or processes, for Windows, Linux and MacOS (posix). Can also be useful for remote visualization/debugging.

shared-memory-example Using shared memory to communicate between two executables or processes, for Windows, Linux and MacOS (posix). Can also be usefu

null 9 Aug 17, 2022