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


=========== CMake BASIS

Build Status

The CMake Build system And Software Implementation Standard (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. More importantly, BASIS supplies a fully integrated suite of functionality to make the whole process seamless!

Homepage | GitHub | SourceForge | Open Hub (Ohloh) | Travis CI


Project Creation

  • Quick project setup with mad-libs style text substitution
  • Customizable project templates


  • Filesystem layout standards
  • Basic software implementation standards
  • Command-line parsing standards
  • Guidelines on coding style

Build system utilities

  • New CMake Module APIs
  • Version Control Integration
  • Automatic Packaging


  • Documentation generation tools
  • Manuals
  • PDF and HTML output of each
  • Integrated with CMake APIs


  • Unit testing
  • Continuous integration
  • Executable testing frameworks

Program Execution

  • Parsing library
  • Command execution library
  • Unix philosophy and tool chains

Supported Languages:

  • C++, BASH, Python, Perl, MATLAB

Supported Packages:

  • CMake, CPack, CTest/CDash, Doxygen, Sphinx, Git, Subversion, reStructuredText, gtest, gflags, Boost, and many more, including custom packages.

Get Started

  1. Get your first taste with the Quick Start Guide.
  2. Check out the How-to Guides for easy introductions to common tasks.
  3. Learn more About CMake BASIS, where it came from and why.
  4. Investigate the Reference and API for more in-depth information.


Additional documentation is available in several locations:


See the installation instructions or the INSTALL file. Information on where the executables and libraries, the auxiliary data, and the documentation files get installed is also available there. For more concise installation steps, have a look at the Quick Start Installation.


If you need help after searching the documentation or want to report a problem, you can reach the CMake BASIS developers on GitHub using the CMake BASIS Issue Tracker.


Copyright (c) 2011-2013 University of Pennsylvania
Copyright (c) 2013-2014 Carnegie Mellon University
Copyright (c) 2013-2016 Andreas Schuh

CMake BASIS is distributed under the terms of the BSD 2-clause License. The complete license text can be found on the download page and in the COPYING.txt file.

Package Content

Path Content description
BasisProject.cmake Meta-data used for the build configuration.
[CMakeLists.txt] 21 Root CMake configuration file.
[config/] 22 Package configuration files.
[doc/] 24 Documentation source files.
[example/] 25 Example files used in the tutorials.
[include/] 26 Public header files.
[src/cmake/] 27 CMake modules and corresponding auxiliary files.
[src/sphinx/] 29 Themes and extensions for the Sphinx documentation tool.
[src/utilities/] 30 Source code of utility functions.
[tools/] 31 Source code of command-line tools and project template.
[test/] 32 Unit tests for the provided libraries.

Legacy GitHub Project

This project was originally developed using Subversion as revision control system. When CMake BASIS was made public as open source, it has been migrated to GitHub using git svn. The Subversion history, however, was quite long and included big data files such as example image data, external libraries such as Boost, PDF files, and PowerPoint presentations. Due to the decentralized nature of Git, having such objects in the revision history of the repository adds significantly to the size of the repository and each clone.

With the release of CMake BASIS version 3.3.0, the history of the Git repository has been rewritten using git filter-branch. Moreover, the CMake modules have been separated from the complete suite of BASIS tools using git subtree split. This reduced the size of the repositories considerably from more than 200MB to less than 10MB and supports the use of only the CMake modules in a project that does not require the complete functionality. The CMake BASIS Modules repository is about 2MB in size when including all revisions. A shallow clone with --depth=1 is less than 1MB. The CMake BASIS Find Modules for use by the find_package command are hosted in another GitHub repository. Developers may copy only those Find modules needed by their project or install the complete set of modules as part of CMake BASIS. The shared CMake modules repositories are integrated into the main project with the git subtree add command. Changes of the CMake modules are first pushed to the main repository and then to the respective subtree repositories using git subtree push.

CMake BASIS versions prior to version 3.3.0 have to be downloaded from the legacy GitHub project because the intrusive history changes broke the integrity of previous versions.

  • [CLOSED] Improve usability of BASIS Manual and API Docs

    [CLOSED] Improve usability of BASIS Manual and API Docs

    Issue by ahundt Tuesday Nov 26, 2013 at 19:36 GMT Originally opened as

    There should be a clear flow from the front page explaining what basis does to getting started pages and instructions to create your first project.

    There should also be clear indication of where you are and where you should go that makes it easy to find where you are going. The manual should continue to be front and center, because many users won't need the API documentation and can just use the quick start guide. Nonetheless, the ability to maintain a mental model of your location on a single BASIS website and browse around within it would dramatically improve the experience of a new user.

    I was thinking integration of Sphinx Documentation and API documentation would be a good way to reach this goal and make the site much easier to navigate.

    It looks like the breathe library (documentation) could help support this goal by integrating the Sphinx Manual directly into doxygen.

    Related discussion and issues can be found at:

    • Issue #234
    • Issue #239
    • Issue #251
    • Issue #253

    Open sub-issues:

    • [x] Add Git clone instructions to download page.
    • [x] Font of download links does not look great within the layout.
    Doc Task 
    opened by schuhschuh 30
  • [CLOSED] Custom Default Project Templates

    [CLOSED] Custom Default Project Templates

    Issue by schuhschuh Thursday Nov 14, 2013 at 23:51 GMT Originally opened as

    Add CMake variable DEFAULT_TEMPLATE which can be set to a custom project template. If such custom template is specified, use and install it instead of the one shipped with BASIS itself. Moreover, if INSTALL_TEMPLATE_DIR is set to an empty string, do not install the template at all. This is useful when the custom project template lives in specific location accessible by the BASIS installation and will remain there. Then it is not necessary to copy the files into the BASIS installation.

    This behavior makes #247 obsolete. The boolean switch is implicit to whether or not a custom template was specified.

    CMake Feature 
    opened by schuhschuh 30
  • [CLOSED] basisproject --noalter option for creating new templates

    [CLOSED] basisproject --noalter option for creating new templates

    Issue by schuhschuh Saturday Nov 09, 2013 at 18:04 GMT Originally opened as

    This option would be useful to create a new template populated with the current version of selected/all template files.

    Example: basisproject --full --noalter

    This option would disable any substitutions during the population of a project directory. For the creation of a new template from another template, another option would be needed, however, which also copies/creates the required file.

    Reporter: Andreas Schuh Assigned to: Andreas Schuh Begin: 2013-10-21 Completed: 0

    Feature Tools 
    opened by schuhschuh 30
  • [CLOSED] Files not copying for independent template

    [CLOSED] Files not copying for independent template

    Issue by ahundt Tuesday Nov 12, 2013 at 20:41 GMT Originally opened as

    I'm having trouble updating my template to use the feature/custom-doc-style branch. Aside from the problem with issue #231, I created a for my template and it seems some of the files aren't copying. For example, I have doc/nrec_logo.png and doc/doxygen_extra.css, and neither of those files seem to copy, even when I specify --doc and --full as parameters.

    I use the following response file createProject.rsp:

       --name "nrecPractice"
       --author "Author Name <[email protected]>" 
       --description "This project is just to practice and test basis." 
       --template nrecBASISTemplate/nrecBASISTemplate-1.0
       --useopt OpenCV 

    I included the for my separate template here:

    # project template configuration script for basisproject tool
    # ------------------------------------------------------------------------------
    version = 1.0
    # ------------------------------------------------------------------------------
    required = [
      # root documentation files
      # root CMake configuration
    # ------------------------------------------------------------------------------
    options = {
      # additional configuration files
      'config-settings' : {
        'desc' : 'Include/exclude custom Settings.cmake file.',
        'path' : [ 'config/Settings.cmake' ]
      'config-components' : {
        'desc' : 'Include/exclude custom Components.cmake file.',
        'path' : [ 'config/Components.cmake' ]
      'config-package' : {
        'desc' : 'Include/exclude custom Package.cmake file.',
        'path' : [ 'config/Package.cmake' ]
      'config-find' : {
        'desc' : 'Include/exclude custom file.',
        'path' : [
      'config-find-version' : {
        'desc' : 'Include/exclude custom file.',
        'path' : 'config/'
      'config-script' : {
        'desc' : 'Include/exclude custom file.',
        'path' : [ 'config/' ]
      'config-test' : {
        'desc' : 'Include/exclude custom file.',
        'path' : [ 'config/' ]
      'config-use' : {
        'desc' : 'Include/exclude custom file.',
        'path' : [ 'config/' ]
      'config' : {
        'desc' : 'Include/exclude all custom configuration files.',
        'deps' : [
      # software data
      'data' : {
        'desc' : 'Add/remove directory for auxiliary data files.',
        'path' : [ 'data/CMakeLists.txt' ]
      # documentation
      'doc' : {
        'desc' : 'Add/remove directory for documentation files.',
        'path' : [ 
      'doc-rst' : {
        'desc' : 'Add/remove reStructuredText (.rst) files for software manual/web site.',
        'path' : [
      # usage example
      'example' : {
        'desc' : 'Add/remove directory for example files.',
        'path' : [ 'example/CMakeLists.txt' ]
      # project modules
      'modules' : {
        'desc' : 'Add/remove support for modularization.',
        'path' : [ 'modules/' ]
      # source files
      'include' : {
        'desc' : 'Add/remove directory for public header files.',
        'path' :[ 'include/' ]
      'src' : {
        'desc' : 'Add/remove directory for project source files.',
        'path' : [ 'src/CMakeLists.txt' ]
      # testing tree
      'test' : {
        'desc' : 'Add/remove support for testing.',
        'path' : [
      'test-internal' : {
        'desc' : 'Add/remove support for internal testing.',
        'path' : [ 'test/internal/CMakeLists.txt' ],
        'deps' : 'test'
    # ------------------------------------------------------------------------------
    # presets
    presets = {
      'minimal' : {
        'desc' : 'Choose minimal project template.',
        'args' : [ 'noconfig', 'nodata', 'nodoc', 'nodoc-rst', 'noexample', 'nomodules', 'noinclude', 'src' ]
      'default' : {
        'desc' : 'Choose default project template.',
        'args' : [ 'noconfig', 'nodata', 'doc', 'doc-rst', 'noexample', 'nomodules', 'include', 'src', 'test' ]
      'toplevel' : {
        'desc' : 'Create toplevel project.',
        'args' : [ 'noconfig', 'nodata', 'doc', 'doc-rst', 'noexample', 'modules', 'noinclude', 'nosrc', 'notest' ]
      'module' : {
        'desc' : 'Create module of toplevel project.',
        'args' : [ 'noconfig', 'nodata', 'nodoc', 'nodoc-rst', 'noexample', 'nomodules', 'include', 'src', 'test' ]
      'full' : {
        'desc' : 'Choose project template with all optional files.',
        'args' : [ 'config', 'doc', 'doc-rst', 'example', 'data', 'nomodules', 'include', 'src', 'test', 'test-internal' ]
    # ------------------------------------------------------------------------------
    # additional substitutions besides <project>, <template-version>,...
    from datetime import datetime as date
    # ------------------------------------------------------------------------------
    substitutions = {
      'date'  :'%x'),
      'day'   :,
      'month' :,
      'year'  :
    del date

    Also, would it be possible to put step by step instructions somewhere for configuring the default template to be different?

    Bug Tools 
    opened by schuhschuh 23
  • [CLOSED] Blank TOC

    [CLOSED] Blank TOC

    Issue by ahundt Monday Jan 06, 2014 at 16:16 GMT Originally opened as

    For some reason the TOC ends up blank with some of the recent changes. I believe that it is possibly due to the use of the ::hidden:: restructured text tag on some of the TOC elements. I've included a screenshot with evidence of the issue below.

    I'm currently using sphinx version 1.2 on OS X installed via homebrew.


    opened by schuhschuh 20
  • [CLOSED] Use single updated README in Markdown for GitHub hosted project

    [CLOSED] Use single updated README in Markdown for GitHub hosted project

    Issue by schuhschuh Monday Dec 23, 2013 at 18:02 GMT Originally opened as

    The README file needs serious updating since the project has been moved from SBIA to GitHub, possibly shorten it quite some to mainly refer to the web site hosted on GitHub. In particular, it would be great to only have a Markdown README file which can be used by GitHub to display the main project information when users browse the source tree. The plain text only version (.txt) is then redundant. Make sure that the CMake commands of BASIS can deal with the different file name extension (.md or .mdown or .markdown) for the README file. This might not yet be the case.

    Doc Task 
    opened by schuhschuh 20


    Issue by ahundt Thursday Nov 14, 2013 at 23:15 GMT Originally opened as

    A boolean option that disables installation of the default template would be useful for when a separate template is supplied using TEMPLATE_DIR.

    CMake Feature 
    opened by schuhschuh 20
  • [CLOSED] Host basis documentation directly on GitHub

    [CLOSED] Host basis documentation directly on GitHub

    Issue by ahundt Monday Nov 11, 2013 at 01:34 GMT Originally opened as

    If we generate the documentation and commit it directly in the repository I believe it is possible to have GitHub host the documentation. Then, if the link to that was more prominently featured in the, we could more genuinely reflect the idea that basis represents both a standard and a tool.

    Example instructions for doing so:

    Doc Task 
    opened by schuhschuh 19
  • [CLOSED] Basis project logo

    [CLOSED] Basis project logo

    Issue by ahundt Monday Nov 18, 2013 at 21:47 GMT Originally opened as

    I think we should have a logo for basis. I think I came up with a nice one. Two bass clefs overlaid on each other. bass is pronounced base, so there are two bases, thus basis. What do you think? :-)


    opened by schuhschuh 18
  • [CLOSED] Isolate SBIA specific Sphinx theme from non-organization specific default

    [CLOSED] Isolate SBIA specific Sphinx theme from non-organization specific default

    Issue by schuhschuh Saturday Nov 09, 2013 at 18:11 GMT Originally opened as

    Currently the SBIA Sphinx theme is the default used for documentation generated by Sphinx. Instead, this theme should be separate from BASIS and by default a theme be used which is not specific to any organization.

    Doc CMake Feature 6 - Accepted / Merged 
    opened by schuhschuh 18
  • [CLOSED] Memorize directory from which project was instantiated in root CMakeLists.txt

    [CLOSED] Memorize directory from which project was instantiated in root CMakeLists.txt

    Issue by schuhschuh Saturday Nov 09, 2013 at 18:04 GMT Originally opened as

    The basisproject tool should keep the directory of the respective template in the root CMakeLists.txt along with TEMPLATE_VERSION such that users don't have to specify a custom template every time they use basisproject to update the project. Therefore, add TEMPLATE_DIRECTORY variable to the root CMakeLists.txt.

    Note that this variable in BASIS itself can be used to specify the default template to use for the BASIS installation, i.e., the default used by basisproject if no --template argument is provided. Reporter: Andreas Schuh Assigned to: Andreas Schuh Begin: 2013-11-09 Completed: 0

    Feature Tools 
    opened by schuhschuh 18
  • basisproject create does not create project folder

    basisproject create does not create project folder

    basisproject create command required for the quick start guide is not creating the project directory. It looks like the fix is already in PR but has not been merged.

    opened by danividanivi 0
  • problems installing MASS

    problems installing MASS

    when trying to compile MASS (ccmake MASS_1.1.0) the following error occurs :

     CMake Error at /opt/basis/share/find-modules/FindPythonModules.cmake:345 (message):
       Could NOT find the following Python modules:
       Check if executing /home/biolab/anaconda3/bin/python -c "import <module>"
       works or set the PythonModules_DIR variable.  Alternatively, set the
       PythonModules_<module>_PATH variable(s) instead or the PYTHONPATH
       environment variable.  Unset PythonModules_DIR if you chose an alternative
       option and before rerunning CMake again.
     Call Stack (most recent call first):
       /opt/basis/share/modules/CommonTools.cmake:56 (_find_package)
       /opt/basis/share/modules/CommonTools.cmake:691 (find_package)
       /opt/basis/share/modules/ProjectTools.cmake:2181 (basis_find_package)
       /opt/basis/share/modules/ProjectTools.cmake:2475 (basis_find_packages)
       /opt/basis/share/modules/ProjectTools.cmake:2751 (basis_project_begin)
       CMakeLists.txt:48 (basis_project_impl)

    Is this related on an incorrect installation of basis? I have python istalled on my machine and all the modules that cmake can't find during compilation actually exist thanks

    opened by rosella1234 1
  • delivering a Windows binary through common package managers

    delivering a Windows binary through common package managers

    Following this post, it would be great if we could have a Windows binary releases as well. Then we could add the software to some of the common Windows package managers.

    I just tested the source code on Windows by:

    cmake --build . --config release --target install

    and except some warnings, it seems to be working perfectly fine.

    opened by Foadsf 9
  • Unable to call Subproject from toplevel project

    Unable to call Subproject from toplevel project

    I am trying to create a project following the structure shown below

    MyWorkspace | | |____ MyFramework1 | | | |__Module1 | | | |Module2 | | MyFramework2 | |___Module1 | |___Module2

    I have created the following equivalent BasisProject structure

    TopLevelProject | | |____ Subproject1 | | | |Module1 | | | BasisProject.cmake | | | |Module2 | | | BasisProject.cmake | | Subproject2 | | | |__Module1 | | | BasisProject.cmake | | | |__Module2 | | BasisProject.cmake | |___________BasisProject.cmake | |___________CMakeLists.txt

    But there is no way the subproject is called from the toplevel project.

    I tried adding basis_add_subdirectory(Subproject1) in the CMakeLists.txt of the toplevelproject. I get the error " Module Subproject1 specified DEFAULT_MODULES, but a module cannot have itself modules."

    I tried adding add_subdirectory(Subproject1) in the CMakeLists.txt of the toplevelproject. I get the error

    "CMake Error at config/basis-modules/InstallationTools.cmake:456 (add_custom_target): add_custom_target cannot create target "uninstall" because another target with the same name already exists. The existing target is a custom target"

    What is the right way to call the subproject from the toplevel project?

    opened by srini2174 6
  • CUDA with BASIS

    CUDA with BASIS

    CMake is now supporting CUDA as a native language. However it is not possible to use basis_add_libraray(TARGET files LANGUAGE CUDA) . The error message is :

     CMake Error at CMake-Basis/3.3.1/share/modules/TargetTools.cmake:519 (target_link_libraries):
       Target "cuda" of type UTILITY may not be linked into another target.
       One may link only to STATIC or SHARED libraries, or to executables with the
       ENABLE_EXPORTS property set.

    Are they any plans to support CUDA?

    opened by issamsaid 1
  • v3.3.1(Feb 2, 2017)

  • v3.3.0(Apr 19, 2016)

    This release starts a new era in the development of the CMake BASIS project. Many artifacts from its origins have been discarded from the revision history to move forward with a lighter and easier to integrate repository. This version of CMake BASIS includes a number of fixes and improvements, mainly driven by the project modularization and CMake BASIS Modules integration demands of the BioMedIA/MIRTK project.

    See Release Notes for more information.

    Source code(tar.gz)
    Source code(zip)
CMake Build system And Software Implementation Standard
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

Jed Brown 82 Nov 4, 2022
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

Jose Luis Blanco-Claraco 393 Nov 18, 2022
CMake module to enable code coverage easily and generate coverage reports with CMake targets.

CMake-codecov CMake module to enable code coverage easily and generate coverage reports with CMake targets. Include into your project To use Findcodec

HPC 82 Oct 25, 2022
unmaintained - CMake module to activate certain C++ standard, feature checks and appropriate automated workarounds - basically an improved version of cmake-compile-features

Compatibility This library provides an advanced target_compile_features() and write_compiler_detection_header(). The problem with those is that they a

Jonathan Müller 72 Apr 14, 2022
📦 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

CPM.cmake 1.5k Nov 25, 2022
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

Cristian Adam 64 Nov 18, 2022
cmake-font-lock - Advanced, type aware, highlight support for CMake

cmake-font-lock - Advanced, type aware, highlight support for CMake

Anders Lindgren 39 Oct 2, 2022
cmake-avr - a cmake toolchain for AVR projects

cmake-avr - a cmake toolchain for AVR projects Testing the example provided The toolchain was created and tested within the following environment: Lin

Matthias Kleemann 162 Oct 24, 2022
Make CMake less painful when trying to write Modern Flexible CMake

Izzy's eXtension Modules IXM is a CMake library for writing Modern flexible CMake. This means: Reducing the amount of CMake written Selecting reasonab

IXM 107 Sep 1, 2022
[CMake] [BSD-2] CMake module to find ICU

FindICU.cmake A CMake module to find International Components for Unicode (ICU) Library Note that CMake, since its version 3.7.0, includes a FindICU m

julp 29 Nov 2, 2022
CMake and other scripts to help build process of FlyEM software

The BuildEM System The buildem repo is a modular CMake-based system that leverages CMake's ExternalProject to simplify and automate a complex build pr

null 27 Jun 9, 2022
A program that automatically generates CMake and Meson configuration files for your Vala project

Autovala is a program and a library designed to help in the creation of projects with Vala and CMake. It also has support for Genie.

Sergio Costas 108 Oct 15, 2022
A template C++ repository, using CMake and Catch

C++ Project Template This is a template project for C++. It uses CMake to build and Catch for unit tests. It is integrated with Travis CI, and builds

Joshua Peterson 49 Oct 23, 2022
Example library that shows best practices and proper usage of CMake by using targets

Modern CMake Sample Sample project that shows proper modern CMake usage on a dummy library and an executable that uses it. Accompanying code to my blo

Pablo Arias 586 Nov 11, 2022
This tries to be a minimal cmake example, that covers sources resources dependencies and packaging.

Minimal CMake Example This project tries to be a minimal cmake example. It covers sources, resources, dependencies and packaging. I created this proje

Arne Döring 158 Nov 15, 2022
A simple CMake utility for building and deploying Qt based applications on Android without QtCreator

Qt Android CMake utility What it is When using Qt for Android development, QMake & QtCreator is the only sane option for compiling and deploying. But

Laurent Gomila 227 Nov 18, 2022
A toolchain file and examples using cmake for iOS development

ios-cmake A toolchain file and examples using cmake for iOS development. This is a fork of a similar project found on

Bogdan Cristea 305 Oct 9, 2022
CMake toolchain file and other scripts for the Android NDK

android-cmake CMake is great, and so is Android. This is a collection of CMake scripts that may be useful to the Android NDK community. It is based on

Andrey Kamaev 1.2k Nov 14, 2022
Visual Studio and GCC precompiled header macro for CMake

cmake-precompiled-header Precompiled header setup for CMake. Supported CMake generators: Visual Studio NMake Makefiles Unix Makefiles (GCC) MinGW Make

Lars Christensen 157 Nov 6, 2022