CMake Tutorial
来源:互联网 发布:淘宝手机访客 编辑:程序博客网 时间:2024/06/05 00:59
Contents
- Introduction
- Getting Started
- IDE Integration
- GUI Tool
- Libraries and Subdirectories
- Functionally Improved Testing
Introduction
What is CMake?
According to CMake’s creators, Kitware, CMake is an open-source cross platform build system. This is not completely accurate as CMake is not actually a build system. What CMake provides is an easy way to build C/C++ projects across platforms. The reason I say that CMake isn’t a build system is because it doesn’t actually build software. “A build system that doesn’t build software?” you ask. Yes; what CMake does is generate a configuration for your existing build system, e.g. Make. This allows CMake to focus on things that most build systems don’t; such as cross platform configuration, dependency calculation, testing, packaging, and installation.
Why CMake?
By not being a true build system, per se, CMake allows for a more flexible development environment as it can generate Makefiles or projects for a variety of IDEs. This allows developers to easily work on different platforms using different tools since one can build using Microsoft’s Visual Studio on Windows or with GNU Make on Linux just as easily.
CMake also includes tools for finding libraries, e.g. boost, and the ability to easily include external projects in your build. These two features, in particular, make it much simpler to build projects that have external dependencies and by using the find tools rather than hard coding paths it is much easier for new developers to get started on an existing project.
Included with CMake is CTest, a test driver program. Both work together to make it easy to run a project’s test programs and/or scripts. When you configure your project you specify how to run your tests and CMake generates a configuration for CTest. CTest will run all of your tests and provide a summary of which ones passed and which ones failed. In addition it logs the output of all the tests it ran. Optionally CTest can be directed to run only specific tests or skip specific tests, perhaps the slow ones. While it may not be a continuous build system you have most of the components provided.
In addition to setting up a build CMake can also create an install target that will install the outputs of your project in the appropriate locations. Once you have configured your project to be installed you can also package your project using the included CPack utility. A variety of packages can be created including tar files, zip files, or an installer.
Acknowledgements
I would like to thank the following people for their help and contributions to this tutorial. Without them it would not exist.
- Devin Ronge
- This tutorial would not exist without Devin, he suggested I write it and motivated me to start. Despite being primarily a C# and JavaScript developer Devin has read every word of this tutorial at least once. Thanks to him you get a better written tutorial than you would had he not proof-read it first.
- Steve Rieman
- As a C++ developer who actively uses CMake Steve has provided a technical review of the sample code in addition to a review of the prose. He has also provided numerous ideas for the contents of this tutorial.
- CMake Tutorial
- CMake Tutorial
- CMake Tutorial
- cmake tutorial
- CMake Tutorial – Chapter 1: Getting Started
- CMake Tutorial (1)——A Basic Starting Point
- CMake Tutorial(2)——Adding a Library
- CMake Tutorial(3)——Installing and Testing
- CMake Tutorial(4)——Adding System Introspection
- CMake Tutorial(6)——Building an Installer
- CMake Tutorial(7)——Adding Support for a Dashboard
- cmake
- cMAKE
- cmake
- CMake
- Cmake
- cmake
- cmake
- UF超滤膜:超滤膜的有效保存方法
- Android如何防止apk程序被反编译
- UBIFS文件系统简介 与 利用mkfs.ubifs和ubinize两个工具制作UBI镜像
- jsp的九大内置对象
- C/C++程序员必须熟练应用的开源项目
- CMake Tutorial
- 解决Playbook不能充电的问题
- Android自己管理Activity和Service
- 【Android】开发优化之——系统性能调优工具:TrackView,Systrace,Oprofile
- Effective C# Item15:利用using和try/finally语句来清理资源
- CMake Tutorial – Chapter 1: Getting Started
- javaWEb-day01(XML约束)
- 紫外线杀菌器:紫外线杀菌装置的工作原理
- 黑马程序员-进程和线程