zeke-mai / cmake-examples

Useful CMake Examples

Home Page:http://ttroy50.github.io/cmake-examples

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

CMake Examples

介绍

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

该仓库包含了一些现代 CMake 的配置示例,这些示例以类似教程的格式进行布局。第一个示例非常基础,并且在先前示例的基础上逐渐增加了复杂性,以展示更复杂的用例。

这些示例已在 Ubuntu 16.04 上进行了测试,但应在任何支持 CMake v3.5+ 的 Linux 系统上运行

此分支适用于 CMake 3.5 及更高版本

Build Status

要求

大多数示例的基本要求为:

  • CMake v3.5+

  • C++ 编译器 (默认为 gcc )

  • make

在 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 python3-pip
    $ sudo pip3 install conan

Docker

Docker containers with all requirements and various versions of CMake are generated to help make testing the examples easier. These are available from the docker hub repository matrim/cmake-examples.

To build the full set of cmake-examples test cases you can run:

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

For more details on build and running the docker containers dockerfiles.

Other Links

There are many CMake tutorials and examples online. The list below includes links to some of these which I have found helpful in my CMake journey.

About

Useful CMake Examples

http://ttroy50.github.io/cmake-examples

License:MIT License


Languages

Language:CMake 48.2%Language:C++ 24.9%Language:Shell 11.0%Language:Python 8.4%Language:Roff 7.6%