The Architecture of Open Source Applications - CMake
2012-10-01 10:58
435 查看
CMake的历史
最早接触CMake还是在使用OpenCV处理视频和图像的时候,CMake解决了在Windows和Linux等多平台的编译问题。CMake源自VTK构建系统:在Unix平台生成Makefile,在Windows平台生成NMake文件,这样就可以利用各个平台现有的编译器来编译。但是VTK的架构不支持诸如libtiff/libjpeg等库,这样在Windows上无法为其创建一个简单已用的IDE,只能在命令行操作不符合Windows平台程序员的习惯。
CMake的产生解决了VTK存在的问题,其特性包括:
* Cmake本身仅依赖于C++编译器
* 在Windows上生成Visual Studio编译所需的配置文件
* 简单易用的GUI
* 自动进行系统的检测、依赖关系的检测
CMake
CMake的执行分为两个过程:配置和生成配置过程:系统检测、环境变量的配置、依赖关系的检测
生成过程:生成平台相关的编译所需文件(作为Visual Studio或者gcc的输入)
Lessons Learned
* 向后兼容* 语言选择问题:应该尽量选择已有的语言来解决复杂的诸如词法分析的问题,而不是自己从头开发一个(现在是基于lex/yacc)
* CMake本身可以支持插件,但由于平台问题,这些插件很有可能在有些平台上失效,故而导致整个编译失败。因此,现在的CMake并不容易扩展,这就避免了由于插件导致的种种的问题。
* 减少对外开放的接口,而对于内部接口不需要维护其向后兼容性。
Reference
http://www.aosabook.org/en/cmake.html相关文章推荐
- The Architecture of Open Source Applications - CMake
- Introduction of 《 The Architecture of Open Source Applications 》
- The Architecture of Open Source Applications: Nginx
- 推荐一本好书《The Architecture of Open Source Applications 》
- The Architecture of Open Source Applications——阅读笔记part 1
- The Architecture of Open Source Applications: The Bourne-Again Shell
- The Architecture of Open Source Applications: The Bourne-Again Shell
- <<the architecture of open source applications>> 中关于虚拟机复制与迁移(上)
- <<the architecture of open source applications>> 中关于虚拟机复制与迁移(下)
- The Architecture of Open Source Applications---VTK
- <<the architecture of open source applications>> 中关于虚拟机复制与迁移(中)
- The Architecture of Open Source Applications
- The Architecture of Open Source Applications: Asterisk
- The Architecture of Open Source Applications - nginx
- The Architecture of Open Source Applications(GDB & zeromq)
- The Architecture of Open Source Applications: Asterisk
- The Architecture of Open Source Applications: Audacity
- The Architecture of Open Source Applications 开源软件体系架构
- The Architecture of Open Source Applications - Berkeley DB
- The Architecture of Open Source Applications