我想为依赖管理器创建一个 block Biicode .我不想接触现有的源代码,所以我必须将现有 Bii block 的包含路径映射到我的源代码中使用的路径。
我在现有代码中使用了以下内容:
#include "gtest/gtest.h"
#include "fw/core/uncopyable_mixin.h"
在默认设置下,Bii 需要以下路径:
#include "google/gtest/include/gtest/gtest.h"
#include "florianwolters/include/fw/core/uncopyable_mixin.h"
如果我替换包含,一切都按预期工作。但正如我已经说过的,我不想要如此丑陋的包含路径,而是使用常识(就像 Boost 和其他库所做的那样)。
因此我确实需要映射路径。我读过 biicode.conf
并偶然发现了 [includes]
部分。
我试过以下方法:
[requirements]
google/gtest: 9
florianwolters/uncopyable-mixin: 0
[parent]
florianwolters/singleton: -1
[paths]
include
[dependencies]
[mains]
[hooks]
[includes]
gtest/gtest.h: google/gtest/include/gtest
fw/core/uncopyable_mixin.h: florianwolters/uncopyable-mixin/include/fw/core
[data]
但这不起作用:
INFO: Processing changes...
WARN: Removing unused reference to "florianwolters/uncopyable-mixin: 0" from florianwolters/singleton "requirements"
WARN: Removing unused reference to "google/gtest: 9" from florianwolters/singleton "requirements"
所以我的问题是:我必须如何配置映射才能使其与现有的 #include
语句一起使用?这必须有效,否则它就是一个 killer 标准...
最佳答案
如果左侧模式与文件名匹配,[includes] 部分将右侧部分添加到左侧。在您的情况下,最后一个文件夹不是必需的。试试看:
[includes]
gtest/gtest.h: google/gtest/include
fw/core/uncopyable_mixin.h: florianwolters/uncopyable-mixin/include
此外,请记住您还可以使用模式(ala fnmatch):
[includes]
gtest/*.h: google/gtest/include
fw/core/*.h: florianwolters/uncopyable-mixin/include
关于c++ - Biicode (biicode.conf) 中的#include 语句映射,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27720874/