CMakeLists.txt文件写法(7):添加查找头文件的路径

本文介绍了如何使用CMake的INCLUDE_DIRECTORIES命令来指定编译器搜索头文件的路径。默认情况下,这些路径会被追加到现有路径列表中,但可以通过设置CMAKE_INCLUDE_DIRECTORIES_BEFORE或使用BEFORE选项改变这一行为。此外,还可以通过SYSTEM选项指定这些路径为系统头文件路径。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

INCLUDE_DIRECTORIES: Add include directories to the build.

  INCLUDE_DIRECTORIES([AFTER|BEFORE] [SYSTEM] dir1 dir2 ...)

Add the given directories to those searched by the compiler for include files. By default the directories are appended onto the current list of directories. This default behavior can be changed by setting CMAKE_INCLUDE_DIRECTORIES_BEFORE to ON. By using BEFORE or AFTER you can select between appending and prepending, independent from the default. If the SYSTEM option is given the compiler will be told that the directories are meant as system include directories on some platforms.  

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值