当前位置:网站首页>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
边栏推荐
猜你喜欢
Code Review Best Practices
How to choose a good company
Do not understand the underlying principle of database index? That's because you don't have a B tree in your heart
Deep into web workers (1)
全网最硬核讲解计算机启动流程
利用线程通信、解决缓存穿透数据库雪崩
Reflection on a case of bus card being stolen and swiped
The most hard core of the whole network explains the computer startup process
Summary of the resumption of a 618 promotion project
use Xunit.DependencyInjection Transformation test project
随机推荐
On the coverage technology and best practice of go code
How to think in the way of computer
Do not understand the underlying principle of database index? That's because you don't have a B tree in your heart
什么都2020了,LINQ查询你还在用表达式树
Web API系列(三)统一异常处理
Count the frequency of letters in text (case insensitive)
A detailed explanation of microservice architecture
Thinkphp6中where条件中字段与字段比较条件的写法
Reflection on a case of bus card being stolen and swiped
屏读时代,我们患上了注意力缺失候群症
计组-总线通信控制之异步串行通信的数据传输
Implementation of Caesar cipher
Recommend suicide, openai warns: gpt-3 is too risky for medical purposes
盘点那些争议最大的编程观点,你是什么看法呢?
看一遍就理解,图解单链表反转
Don't treat exceptions as business logic, which you can't afford
阿里terway源码分析
洞察——风格注意力网络(SANet)在任意风格迁移中的应用
【原创】ARM平台内存和cache对xenomai实时性的影响
How did I lose control of the team?