在 CMake 中使用 include_directories 时忽略单个文件
无论如何,在使用 include_directories
时,是否有办法告诉 CMake 忽略一个特定的头文件?
由于目录没有扩展为单个文件,我不能仅列出(REMOVE_ITEM ..) 文件。
欢呼丹尼尔
is there anyway to tell CMake to ignore one specific header file when using include_directories
?
Since the directories are not expanded into single files I can't just list(REMOVE_ITEM ..)
the file out.
cheers Daniel
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
CMakeLists 中的 include_directories 调用不会生成所有可用头文件的列表。它只是将这些目录直接传递给编译器作为“#include <...>”的搜索目录例如,查看文档对于 GCC 4.6 的“-I”选项。
另外:我不确定您为什么要排除单个文件。通常,您可以通过在自己的项目中创建自己的头文件来解决有问题的头文件,其中包括除单个文件之外的所有内容...
如果您真的非常想要这样的东西并且坚持使用 CMake 解决它,您可能最终会得到 file-globing< /a> 所有头文件,将它们手动复制(当然没有那个文件)到新的包含目录,然后包含该新目录。
An include_directories call in CMakeLists does not result in a list of all available header-files. It simply passes those directories directly to the compiler as a search-dir for your "#include <...>" E.g. look at the documentation for the "-I" option of GCC 4.6.
In addition: I am not sure why you would want to exclude a single file. Very often you can work around a problematic header file, by creating your own header-file in your own project which includes everything except that single-file...
If you really, really want something like this and you insist on solving it with CMake, you will probably end up with file-globing all header-files, copying (without that one file of course) them manually to a new include-dir and then include that new dir.