include_directories link_directories add_definitions
时间: 2023-12-29 13:40:54 浏览: 96
在CMake中,include_directories命令用于向项目中添加包含目录,以便编译器能够找到头文件。其格式如下:include_directories(\[AFTER|BEFORE\] \[SYSTEM\] directory1 \[directory2 ...\])。\[2\]
link_directories命令用于添加目录,以便链接器能够在其中查找库文件。其格式如下:link_directories(\[AFTER|BEFORE\] directory1 \[directory2 ...\])。\[1\]
add_definitions命令用于向项目中添加预处理器定义。其格式如下:add_definitions(-DDEFINE_NAME)。\[3\]
总结起来,include_directories用于添加包含目录,link_directories用于添加链接目录,add_definitions用于添加预处理器定义。
#### 引用[.reference_title]
- *1* *3* [CMake中link_directories/target_link_directories的使用](https://blog.csdn.net/fengbingchun/article/details/128292359)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item]
- *2* [CMake中target_include_directories的使用](https://blog.csdn.net/fengbingchun/article/details/128292218)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item]
[ .reference_list ]
阅读全文