c++ - Biicode (biicode.conf) 中的#include 语句映射

标签 c++ include dependencies dependency-management biicode

我想为依赖管理器创建一个 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/

相关文章:

c++ - 库中的引号是否包含 C++ 中的路径意味着项目的基本目录?

c++ - 如何为想要公开相互递归函数的仅 header 库组织包含?

matlab - 跟踪函数在 MATLAB 中的文件夹/文件中被引用的次数?

c++ - 第一次出现的非重复数字

c++ - DirectX HLSL 包含指令不起作用

c++ - 运行时绑定(bind) C++

android - 未能解决依赖关系。?

java - 为什么我必须添加Lombok插件,为什么添加依赖还不够

c++ - 如何使用 QPainter 缩放文本以适应边界框?

c# - 用于使用 C#、C++/CLI 和非托管 C++ 的应用程序的内存分析工具