当前位置:网站首页>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
边栏推荐
猜你喜欢
Huawei HCIA notes
Advanced concurrent programming series 9 (lock interface analysis)
delphi10的rest.json与system.json的踩坑
某618大促项目的复盘总结
Insight -- the application of sanet in arbitrary style transfer
Three steps, one pit, five steps and one thunder, how to lead the technical team under the rapid growth?
laravel8更新之维护模式改进
A detailed explanation of microservice architecture
来自不同行业领域的50多个对象检测数据集
一万四千字分布式事务原理解析,全部掌握你还怕面试被问?
随机推荐
Web安全(二)---跨域资源共享
Business Facade 与 Business Rule
聊聊Go代码覆盖率技术与最佳实践
30岁后,你还剩下什么?
If you want to forget the WiFi network you used to connect to your Mac, try this!
AFO
洞察——风格注意力网络(SANet)在任意风格迁移中的应用
What do you think of the most controversial programming ideas?
On hiz buffer
Technical debt is a lack of real understanding of business functions- daverupert.com
In the age of screen reading, we suffer from attention deficit syndrome
Kubernetes服务类型浅析:从概念到实践
static+代码块+多态+异常
awk实现类sql的join操作
Design pattern of facade and mediator
Count the frequency of letters in text (case insensitive)
Vscode configuration
vscode 配置
On the coverage technology and best practice of go code
chrome浏览器跨域Cookie的SameSite问题导致访问iframe内嵌页面异常