当前位置:网站首页>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
边栏推荐
猜你喜欢
随机推荐
工作1-3年的程序员,应该具备怎么样的技术能力?该如何提升?
Implementation of multi GPU distributed training with horovod in Amazon sagemaker pipeline mode
static+代码块+多态+异常
洞察——风格注意力网络(SANet)在任意风格迁移中的应用
How to choose a good company
如何以计算机的方式去思考
Count the frequency of letters in text (case insensitive)
一次公交卡被“盗刷”事件带来的思考
[C + + learning notes] how about the simple use of the C + + standard library STD:: thread?
Web API系列(三)统一异常处理
栈-括号的匹配
awk实现类sql的join操作
The CPU does this without the memory
来自不同行业领域的50多个对象检测数据集
AFO
How to think in the way of computer
汇编函数mcall systemstack asmcgocall syscall
华为HCIA笔记
从技术谈到管理,把系统优化的技术用到企业管理
The prediction accuracy of the model is as high as 94%! Using machine learning to solve the 200 billion dollar inventory problem perfectly





