实例介绍
CMake 教程高清文字版,图解CMake原理过程。非常详细。带书签。
Contents 1 Overview 1.1 What CMake can do 1. 2 What can't be done with cmake 14 2 First step 19 Make installation 19 2.2 Native build tool 27 2.3 Compiler 38 2.4 Minimal example 2.5 Generate native tool files 2.6 Build and run executable 3 Tutorials 3.1 CMake stages 67 3.2 Out-of-source build 72 3.3 Workfile 74 3.4 Version and policies 78 3.5 Project de 3.6 Variables 3. 7 CMake listfiles ,,..,,.,,,,,,,136 3.8 Control structures 152 3.9 Executables 169 3.10 Tests 171 3.11 Librar 175 3.12 Pseudo targets 201 3.13 Collecting sources ..201 3. 14 Usage requirements .203 3.15 Build types 203 3.16 configure_file 203 3.17 Install 3. 18 Toolchain 223 3.19 Generator expressions 3.20 Properti 231 3.21 Packing 231 3.22 Continuous integration ....231 4 Platforms 233 233 4.2 Android 233 5 Generators 253 253 6 Compilers 255 7 Contacts 7.1 Publ 257 7.2 Private 7.3Hi 257 7.4 Donations 257 8 Rejected 259 8. 1 ExternalProject Add 259 8.2 FindXXXcmake 8.3 macro 260 8.4 Object libraries .260 8.5 target_compile features 8.6 write_compiler_detection_header 264 9 Glossary 9.1-B 267 9.2-H 267 9.3-S 268 9. 4 CMak 268 9.5 Git 9.6Hu 269 9.7 Native build tool 269 9.8 VCS 270 9.9 Binary tre 9.10 Cache variables ...270 9.11 CMake module 271 9.12 CMake variables ....271 9.13 CMake Cache txL 9. 14 CMakeLists. txt 271 9. 15 Developer Command Prompt 272 9.16 Listfile 272 9.17 Multi-configuration generator 273 9. 18 One Definition Rule ( ODR) 9.19 Single-configuration generator 274 9.20 Source tree 274 CGold documentation release 0.1 Warning: THIS DOCUMENT IS UNDER CONSTRUCTION! WORK IN PROGRESS. Welcome to gOld! This guide will show you how to use CMake and will help you to write elegant, correct and scalable projects. We'll start from the simple cases and add more features one by one. This tutorial covers only part of the CMake capabilities some topics are skipped intentionally in favor of better modern approaches Document designed to be a good tutorial for the very beginners but touches some aspects in which advanced developers may be interested too. Look at this document as a skeleton/starting point for further CMake learning Enjoy! See rejected section for list with detailed descriptio Contents CGold documentation Release 0.1 Contents CHAPTER Overview 1.1 What CMake can do CMake is a meta build system. It can generate real native build tool files from abstracted text configuration. Usually such code lives in CMakelists. txt files What does it mean and how it can be useful? 1.1.1 Cross-platform development Let's assume you have some cross-platform project with C++ code shared along different platformS/DEs. Say you use Visual Studio on Windows Xcode on OSX and Makefile for linux Build tool Visual studio Xcode Makefile Build command ms build xcodebuild ake binaries What you will do if you want to add new bar. cpp source file? You have to add it to every tool you use 3 CGold documentation Release 0.1 barcpp add add add add Build tools Visual studio Xcode Makefile BuiLd command msbuild xcodebuild make binaries To keep the environment consistent you have to do the similar update several times. And the most important thing is that you have to do it manually(arrow marked with a red color on the diagram in this case). of course such approach is error prone and not flexible. CMake solve this design flaw by adding extra step to development process. You can describe your project in CMakeLists. txt file and use CMake to generate tools you currently interested in using cross-platform CMake code Chapter 1. Overview CGold documentation Release 0.1 CMake lists. txt cmake Build tools Visual studio Xcode Makefile Build command msbuild xcodebuild make binaries Same action -adding new bar. cpp file, will be done in one step now 1.1 What CMake can do CGold documentation Release 0.1 barcpp add CMakelists. txt care Build tools Visual studio Xcode Makefile Build command msbuild xcodebuild ake binaries Note that the bottom part of the diagram was not changed. I.e. you still can keep using your favorite tools like Visual Studio/msbuild, Xcode/xcodebuild and Makefile/ make See also KDE moving from autotools to cmake Visual C++ Team Blog: Support for Android CMake projects in Visual Studio Android Studio: Add C and C++ code to Your Project Chapter 1. Overview 【实例截图】
【核心代码】
标签:
小贴士
感谢您为本站写下的评论,您的评论对其它用户来说具有重要的参考价值,所以请认真填写。
- 类似“顶”、“沙发”之类没有营养的文字,对勤劳贡献的楼主来说是令人沮丧的反馈信息。
- 相信您也不想看到一排文字/表情墙,所以请不要反馈意义不大的重复字符,也请尽量不要纯表情的回复。
- 提问之前请再仔细看一遍楼主的说明,或许是您遗漏了。
- 请勿到处挖坑绊人、招贴广告。既占空间让人厌烦,又没人会搭理,于人于己都无利。
关于好例子网
本站旨在为广大IT学习爱好者提供一个非营利性互相学习交流分享平台。本站所有资源都可以被免费获取学习研究。本站资源来自网友分享,对搜索内容的合法性不具有预见性、识别性、控制性,仅供学习研究,请务必在下载后24小时内给予删除,不得用于其他任何用途,否则后果自负。基于互联网的特殊性,平台无法对用户传输的作品、信息、内容的权属或合法性、安全性、合规性、真实性、科学性、完整权、有效性等进行实质审查;无论平台是否已进行审查,用户均应自行承担因其传输的作品、信息、内容而可能或已经产生的侵权或权属纠纷等法律责任。本站所有资源不代表本站的观点或立场,基于网友分享,根据中国法律《信息网络传播权保护条例》第二十二与二十三条之规定,若资源存在侵权或相关问题请联系本站客服人员,点此联系我们。关于更多版权及免责申明参见 版权及免责申明
网友评论
我要评论