2 Star 0 Fork 2

CryingN/cmake-example

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

CMake示例

引言

CMake是一个跨平台的开源元构建系统用于构建, 测试和打包软件. 它可以支持多种构建环境, 包括苹果的xcode和微软的Visual Studio.

这个存储库包括我挑选的一些现代CMake配置示例, 当探索它在各种项目中的用途时. 这些例子以类似教程的形式列出. 第一个例子是非常基本的, 在前面的例子的基础会慢慢出现更加复杂的用例.

这些例子已经在Ubuntu 16.04与arch 5.15.90上进行了测试, 但应该可以在任何支持CMake v3.5+的Linux系统下运行. 此版本适用的版本CMake >= 3.5。

构建状态

需求

大多数示例的基本环境有:

  • CMake >= v3.5+

  • cpp编译器 (一般为gcc)

  • make

在arch上安装

$sudo pacman -S gcc,cmake

某些特定示例可能需要其他工具, 包括:

  • boost

    $ sudo pacman -S boost
  • protobuf

    $ sudo pacman -S protobuf
  • cppcheck

    $ sudo pacman -S cppcheck
  • clang

    $ sudo pacman -S clang
  • ninja

    $ sudo pacman -S ninja
  • conan

    $ sudo pacman -S conan

在Ubuntu上安装

在Ubuntu上安装上述软件的最简单方法如下

$sudo apt-get install build-essential
$sudo apt-get install cmake

某些特定示例可能需要其他工具, 包括:

  • boost

    $ sudo apt-get install libboost all dev
  • protobuf

    $ sudo apt-get-install libprotobuf-dev
    $ sudo apt-get-install protobuf-compiler
  • cppcheck

    $ sudo apt-get-install cppcheck
  • clang

    $ sudo apt-get-install clang-3.6
  • ninja

    $ sudo apt-get install ninja-build
  • conan

    $ sudo apt-get install python3 python3pip
    $ sudo pip3 install conan

Docker

生成了具有所有需求和各种版本CMake的Docker容器,以帮助简化示例测试。这些可从docker hub存储库链接获得: 矩阵/cmake-examples.

要构建完整的cmake示例测试用例集,您可以运行:

docker run -it matrim/cmake-examples:3.5.1
cd ~
git clone https://github.com/ttroy50/cmake-examples.git code
cd code
./test.sh

有关构建和运行docker容器链接的更多详细信息,请访问: dockerfiles

其他链接

网上有许多CMake的教程和示例。下面的列表包括链接, 我发现其中一些对我的CMake之旅很有帮助.

The MIT License (MIT) Copyright (c) 2015 Thom Troy Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

一些cmake的使用案例教程, 正在翻译 展开 收起
README
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/cryingn/cmake-example.git
git@gitee.com:cryingn/cmake-example.git
cryingn
cmake-example
cmake-example
master

搜索帮助