Giter Site home page Giter Site logo

cmake's Introduction

CMake Modules

This repository contains common CMake modules and a collection of find scripts to locate non-CMake dependencies. The recommended way to use it is:

As a git submodule

In your project source dir, do:

git submodule add https://github.com/Eyescale/CMake CMake/common

And include it in the top-level CMakeLists.txt as follows:

list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/CMake/common)
include(Common)

Documentation

The following CMake modules can be included in your project:

  • Common does a common CMake setup, and also includes:
    • CommonLibrary common_library function to build a (shared) library using a standard recipe and generates header files for the library (api.h, version.h).
    • CommonApplication common_application function to build an application using a standard recipe.
    • CommonFindPackage common_find_package for more convenience over find_package and common_find_package_post (must be last after all common_find_package calls) to generate defines.h and options.cmake for feature checking.
    • CommonCompiler: Default compiler flags (including C++14) and useful default warnings can be set on given target to common_compile_options(); automatically applied for targets created with common_application() and common_library()
    • CommonHelp common_help function to create a documentation page from an application's --help output.
    • GitInfo sets variables with information about the git source tree.
    • GitTargets branch, cut, tag, erase, retag, tarball targets.
  • CommonCTest should be included from a tests subfolder. Does a common CTest setup, automatically adding all .cpp files in the current folder as unit tests to a tests target. It also includes:
    • CommonCoverage coverage target to generate a code coverage report as html, if COMMON_ENABLE_COVERAGE option is set. Additional compiler flags are set in that case, so it should be enabled only for debug builds.
    • CommonCPPCheck: cppcheck target for static code analysis. Also adds all cppcheck targets to tests target.
    • CommonClangCheck: clangcheck target for clang-check code analysis. Adds all clangcheck targets to tests if COMMON_ENABLE_CLANGCHECK_TESTS is set.
  • CommonPackageConfig generates cmake package information files for the project. These files let other CMake-based projects locate it through find_package (in config mode, without the need for a finder script). Must be included at the end of the CMakeLists.txt, after all targets have been added via common_library() and common_application().
  • CommonCPack Configures the CPack package generator to redistribute the project as an installable package. Also includes CommonPackageConfig.
  • DoxygenRule: doxygen target to build documentation into PROJECT_BINARY_DIR/doc. Optional doxycopy target to copy the results to ../GITHUB_ORGANIZATION/Project-M.m/. Must be included after all other targets.
  • SubProject: This module is automatically included in Common.cmake to build several CMake subprojects (which may depend on each other), which are declared in a .gitsubprojects file. To be compatible with the SubProject feature, (sub)projects might need to adapt their CMake scripts. Generally, CMAKE_BINARY_DIR should be changed to PROJECT_BINARY_DIR and CMAKE_SOURCE_DIR should be changed to PROJECT_SOURCE_DIR. See SubProject documentation for more details. A simple example project can be found at https://github.com/Eyescale/Collage.git, and a more complex one at https://github.com/BlueBrain/Brayns.git.

Additional features:

  • InstallDependencies lets users install known system packages during the initial configuration by doing "cmake -DINSTALL_PACKAGES=1". This is only implemented for Linux distributions using apt-get and yum package managers and MacPorts in OS X. The actual support depends on the project declaring its dependencies for each particular case.
  • CommonGraph adds graphs target to generate .png tree view of dependencies, gathered by CommonFindPackage and SubProject.

Detailed Change Log

cmake's People

Contributors

biddisco avatar brunomaga avatar chevtche avatar cstalder avatar dardok avatar delalond avatar delyas avatar eile avatar favreau avatar jmespadero avatar kaabimg avatar lguyot avatar marwan-abdellah avatar mgeplf avatar ptoharia avatar purplekarrot avatar timocafe avatar tribal-tec avatar yarda avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.