在 Adacore 的 GPR 文件中,如何设置编译器包含 C++ 的搜索路径

In Adacore's GPR file, how can I set the compiler include search paths for C++

我有一些 C++ 代码需要使用 Adacore GNAT Programming Studio 进行编译。

一个文件 (SomeHeader.h) 位于 Common 目录 (../../Common/) relative到我的 GPR 文件。

我们对 C++ 包含指令的约定是使用

#include "Common/SomeHeader.h"

无论我做什么,我都无法让 GprBuild 找到 "Common/SomeHeader.h" 我按照 AdaGem 108 上的说明进行了修改,并针对 C++

for Include_Switches ("c++") use ("-I ../../");

for Include_Path ("c++") use "../..";

None 这似乎在 gprbuild 期间对我有用,令人沮丧的是我似乎无法获得 gprbuild 即使在提高构建详细程度后仍在使用。

我在构建消息中看到一些临时文件,但在我访问它们之前它们被删除了。

我在 Windows 10 i686-pc-mingw32、GNAT Pro 17.1 上使用 Adacore GPS 17.1。

有谁知道如何在 Adacore 的 Gprbuild 中获取包含搜索路径?

我还没有尝试使用 gprbuild 来编译 C++ 源文本,但我想它的工作方式或多或少类似于 Ada,您可以在其中将相关目录添加到 Source_Dirs 属性:

project Cookie is
   for Languages use ("C++");

   for Source_Dirs use (".",
                        "../..");

   [...]
end Cookie;

如果你想使用相对路径,并且你死定了使用 -I 标志,请注意编译你的 C++ 代码时的当前目录被设置为配置的 obj 目录对于 grp.

因此,如果您要包含的目录位于 C:\Foo\Bar\src\include\ 而您的 grp obj 目录位于 C:\Foo\Bar\env\gpr\obj 那么您的相对路径将需要使用 -I..\..\..\src\include