当前位置:网站首页>Cpp(三) 什么是CMake
Cpp(三) 什么是CMake
2020-11-07 20:58:00 【Coxhuang】
文章目录
- 什么是CMake
- #1 环境
- #2 Cpp流程
什么是CMake
#1 环境
macOS 10.15.5
#2 Cpp流程
什么是CMake? 需要先了解Cpp的流程
- 用编辑器(VSCode/Clion等)编写源代码,如main.cpp文件
- 用编译器编译代码生成目标文件,如.o
- 用链接器连接目标代码生成可执行文件,如Windows下的.exe和Linux下的可执行文件
- make
如果源文件(.cpp)过多,一个一个编译就会特别麻烦,于是就有了
make工具,它是一个自动化编译工具,可以使用一条命令实现完全编译,但是开发者需要编写一个规则文件,make依据规则文件来批处理编译,这个文件就是makefile
- CMake
但是对于一个特别巨大的工程来说,编写一个
makefile确实是一件非常复杂的事情,于是出现了CMake,CMake负责读入所有源文件,然后自动生成makefile,但是这时,需要开发者编写一个规则文件,CMake通过这个规则文件生成makefile,这个文件就是CMakeLists.txt
所以,一个Cpp工程,从源码到运行,可以手动编写
makefile文件,然后编译,生成一个可执行文件;也可以编写CMakeLists文件,通过CMake工具,自动生成makefile文件,然后编译生成可执行文件
本文参与腾讯云自媒体分享计划,欢迎正在阅读的你也加入,一起分享。
版权声明
本文为[Coxhuang]所创,转载请带上原文链接,感谢
https://cloud.tencent.com/developer/article/1744570
边栏推荐
猜你喜欢

大数据算法——布隆过滤器

Tips for Mac novices

Three steps, one pit, five steps and one thunder, how to lead the technical team under the rapid growth?

在pandas中使用pipe()提升代码可读性

计组-总线通信控制之异步串行通信的数据传输

WPF 关于绘图个人总结

Using thread communication to solve the problem of cache penetrating database avalanche

一万四千字分布式事务原理解析,全部掌握你还怕面试被问?

一次公交卡被“盗刷”事件带来的思考

laravel8更新之维护模式改进
随机推荐
The most hard core of the whole network explains the computer startup process
在 Amazon SageMaker 管道模式下使用 Horovod 实现多 GPU 分布式训练
Don't treat exceptions as business logic, which you can't afford
全网最硬核讲解计算机启动流程
Win10官方1909版本无法打开windows安全中心中病毒和威胁防护的实时保护解决方案。
C language I blog assignment 03
vscode 配置
WPF 关于绘图个人总结
不懂数据库索引的底层原理?那是因为你心里没点b树
Principles of websocket + probuf
Big data algorithm - bloon filter
分享几个我日常使用的VS Code插件
[C + + learning notes] how about the simple use of the C + + standard library STD:: thread?
利用线程通信、解决缓存穿透数据库雪崩
快速上手Git
How to deal with data leakage and deletion related to business life and death?
Adobe media encoder /Me 2021软件安装包(附安装教程)
laravel8更新之维护模式改进
The official 1909 version of win10 cannot open the real-time protection solution of virus and threat protection in windows security center.
Technical debt is a lack of real understanding of business functions- daverupert.com