当前位置:网站首页>cmake常用命令
cmake常用命令
2022-06-11 02:00:00 【玛了个玛卡巴卡】
project(工程名)
#必需
set(变量名 路径)
#定义变量,在之后可以使用${变量名}来表示路径
file(GLOB 变量名 globbing表达式)
#会产生一个由所有匹配globbing表达式的文件组成的列表,并将其保存到变量中
file(GLOB_RECURSE 变量名 globbing表达式)
#与GLOB类似,区别在于会遍历匹配目录的所有文件以及子目录下面的文件
add_compile_options(编译选项)
#添加编译选项,如-g -std=c++17 -O2
include_directories(头文件路径)
#加入头文件搜索路径
link_directories(库文件基准路径)
#指定库文件基准路径,必须写在add_executable之前
#库文件是已经编译好的程序,使用库文件而不是源文件可以大大缩短编译时间
#库文件分为静态库和动态库。静态库在程序编译时被链接到目标代码中。
#动态库(共享库)在程序编译时并不会被链接到目标代码中,而是在程序运行时才载入;
#不同程序需要相同的库时,在内存中只需要有一份该共享库的拷贝,避免了空间浪费问题;
#并且在运行时才会被载入,也解决了静态库对程序的更新,部署和发布带来的麻烦
add_executable(生成可执行文件名 要编译文件的路径1 要编译文件的路径2 ...)
#必需
target_link_libraries(生成可执行文件名 库文件路径)
#链接共享库,必须写在add_executable之后
边栏推荐
- Li Kou brushing questions - hash table
- English subtitle video translated into Chinese subtitles
- Project load failed
- SD3.0笔记
- About stepping on the pit diary and the association of knowledge points
- SQL | 外连接
- 环糊精金属有机骨架(β-CD-MOF)装载二巯丁二酸/大黄素/槲皮素/三氯蔗糖/二氟尼柳/奥美拉唑(OME)
- [AI weekly] AI and freeze electron microscopy reveal the structure of "atomic level" NPC; Tsinghua and Shangtang proposed the "SIM" method, which takes into account semantic alignment and spatial reso
- To view the data in redis, in addition to the command line and client, you have a third option
- Xampp is used under M1 chip, and the installation extension error
猜你喜欢

Principle of everything for fast search

The most complete format description of clang format

Limiting visibility of symbols when linking shared libraries

软件测试英语常见词汇

叶酸配体的金属有机骨架材料MOFs负载5-氟尿嘧啶,西达本胺,紫杉醇,阿霉素,柔红霉素,布洛芬,喜树碱,姜黄素,藤黄酸等小分子药物

Sd3.0 notes

To view the data in redis, in addition to the command line and client, you have a third option

学习太极创客 — ESP8226 (二)

2022 safety officer-a certificate special operation certificate examination question bank and simulation examination

Why is the trend chart of precious metal silver strong?
随机推荐
The most complete format description of clang format
Unity camera camera about layer mask cullingmask settings
Li Kou brushing questions - hash table
SQL | external connection
APP测试_测试点总结
Modify release opening animation
String operation methods: replace, delete and split strings
Customized redistemplate in redis
ShaderGraphs
CPT 102_LEC 20
Fundamentals of deep learning [4] build easyocr and carry out simple character recognition from 0
error exepected identifier before ‘(‘ token, grpc 枚举类编译错误
378. 有序矩阵中第 K 小的元素
Project load failed
【AI周报】AI与冷冻电镜揭示「原子级」NPC结构;清华、商汤提出「SIM」方法兼顾语义对齐与空间分辨能力
Web watermark
[AI weekly] AI and freeze electron microscopy reveal the structure of "atomic level" NPC; Tsinghua and Shangtang proposed the "SIM" method, which takes into account semantic alignment and spatial reso
clang-format 最全格式说明
CPT 102_LEC 18
421. 数组中两个数的最大异或值