当前位置:网站首页>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
边栏推荐
- Bgfx compilation tutorial
- Using pipe() to improve code readability in pandas
- How Facebook open source framework simplifies pytorch experiment
- AFO记
- awk实现类sql的join操作
- 来自不同行业领域的50多个对象检测数据集
- [random talk] the goal and way of software design
- 动态规划——用二进制表示集合的状态压缩DP
- Design pattern of facade and mediator
- C language I blog assignment 03
猜你喜欢

技术总监7年自述——如何选择一家好公司

不要把异常当做业务逻辑,这性能可能你无法承受

Business Facade 与 Business Rule

Web API series (3) unified exception handling

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

Bgfx compilation tutorial

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

使用 Xunit.DependencyInjection 改造测试项目

Reflection on a case of bus card being stolen and swiped

Improvement of maintenance mode of laravel8 update
随机推荐
Tips for Mac novices
技术债务是对业务功能缺乏真正的理解 -daverupert.com
低代码 vs 模型驱动,它们之间到底是什么关系?
小熊派开发板实践:智慧路灯沙箱实验之真实设备接入
go wire 依赖注入入门
The official 1909 version of win10 cannot open the real-time protection solution of virus and threat protection in windows security center.
手撕算法-手写单例模式
Advanced concurrent programming series 9 (lock interface analysis)
快速上手Git
编程界大佬教你:一行Python代码能做出哪些神奇的事情?
graph generation model
30岁后,你还剩下什么?
Git代码提交操作,以及git push提示failed to push some refs'XXX'
How to choose a good company
模型预测准确率高达94%!利用机器学习完美解决2000亿美元库存难题
Dynamic programming -- state compression DP of set represented by binary
Three steps, one pit, five steps and one thunder, how to lead the technical team under the rapid growth?
一次公交卡被“盗刷”事件带来的思考
工作1-3年的程序员,应该具备怎么样的技术能力?该如何提升?
Recommend suicide, openai warns: gpt-3 is too risky for medical purposes