Search code examples
gnatgprbuild

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


I have some C++ code that I need to compile using Adacore GNAT Programming Studio.

One file (SomeHeader.h) is in a Common directory (../../Common/) relative to my GPR file.

Our convention for C++ include directives is to use

#include "Common/SomeHeader.h"

No matter what I do, I cannot get GprBuild to find "Common/SomeHeader.h" I followed the instructions here at AdaGem 108 with modifications for C++

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

and

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

None of this seems to work for me during gprbuild and frustratingly I can't seem to get at the backend command that gprbuild is using even after turning the build verbosity up.

I see some temp files in the build messages but they get deleted before I can access them.

I am using Adacore GPS 17.1 on Windows 10 i686-pc-mingw32, GNAT Pro 17.1.

Does anyone know how to get include search paths working in Adacore's Gprbuild?


Solution

  • I haven't tried to use gprbuild for compiling C++ source text yet, but I suppose it works more or less like with Ada, where you add the relevant directories to the Source_Dirs attribute:

    project Cookie is
       for Languages use ("C++");
    
       for Source_Dirs use (".",
                            "../..");
    
       [...]
    end Cookie;