1 Star 0 Fork 1

chris / CMake

forked from Lorie / CMake 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
BSD-3-Clause

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.
    • CommonCheckTargets adds test targets for various static code checkers if the COMMON_ENABLE_STATIC_TESTS option is set.
    • 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

Unless otherwise noted in the file, all files in this repository are licensed under the BSD license, reproduced below. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - Neither the name of Eyescale Software GmbH nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

简介

暂无描述 展开 收起
BSD-3-Clause
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
1
https://gitee.com/chris_reboot/CMake.git
git@gitee.com:chris_reboot/CMake.git
chris_reboot
CMake
CMake
master

搜索帮助