使用-isystem代替-I与CMake的 [英] Use -isystem instead of -I with CMake

查看:168
本文介绍了使用-isystem代替-I与CMake的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有任何的CMake办法强迫通过include_directories规定(或者通过不同的功能)的路径与海湾合作委员会建立时使用的-isystem标志,而不是-I标志呢?

Is there any way in CMake to force a path specified via include_directories (or perhaps through a different function) to use the -isystem flag instead of the -I flag when building with gcc?

请参阅http://gcc.gnu.org/onlinedocs/gcc/Directory-Options.html#Directory-Options关于-I和细节-isystem。

See http://gcc.gnu.org/onlinedocs/gcc/Directory-Options.html#Directory-Options for details on -I and -isystem.

推荐答案

是的,你强制路径是一个系统,包括通过使用可选的系统标志

Yes you force a path to be a system include by using the optional SYSTEM flag

include_directories(SYSTEM path)

<一个href=\"http://www.cmake.org/cmake/help/cmake-2-8-docs.html#command:include_directories\">http://www.cmake.org/cmake/help/cmake-2-8-docs.html#command:include_directories

与CMake的2.8.12开始,你可以使用新的target_include_directories包括系统目录包括在目标水平,同时利用cmake的新的使用要求的特点:

Starting with CMake 2.8.12 you can use the new target_include_directories to include system directory includes at the target level, while leveraging the new usage requirement features of cmake:

target_include_directories(foo SYSTEM PUBLIC path)

现在的目标foo将使用路径作为一个系统包括,和任何链接
富也将作为自动系统包括使用路径。您可以通过改变PUBLIC关键字私人或接口控制这些使用需求的传播。

Now target foo will use path as a system include, and anything that links to foo will also use path as automatically as a system include. You can control the propagation of these usage requirements by changing the PUBLIC keyword to PRIVATE or INTERFACE.

<一个href=\"http://cmake.org/cmake/help/v2.8.12/cmake.html#command:target_include_directories\">http://cmake.org/cmake/help/v2.8.12/cmake.html#command:target_include_directories

这篇关于使用-isystem代替-I与CMake的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆