How to include headers from C++ library?

Hello,

I’m trying to use a 3rd party library (FakeIt) that only has headers (ie. there’s no library to link against). How would I include it as a dependency for my C++ project? For now I’m doing something that could be summarised as:

model {
    components {
        test(NativeExecutableSpec) {
            binaries.all {
                cppCompiler.args "-I/path/to/lib/include"
            }
        }
    }
}

But I would rather use something similar to the syntax

...
        test(NativeExecutableSpec) {
            sources.cpp {
                lib library: 'fakeit'
            }
        }
...

Is there a way to do this? If not, would it be to useful to extend PrebuiltLibraries to have libraries without binaries, or create a HeaderOnlyLibraries?

You can use PrebuiltLibraries for this:

Look at the boost prebuilt library. You add a library requirement with it using the ‘api’ linkage.

lib library: 'fakeit', linkage: 'api'

Excellent. What I needed was the linkage: 'api' part. I only knew about static and shared linkage. Thank you very much! =)