How to compile other project from current project for CPP code?

I have a CPP project structure like:


– project A

– project B

I want to run/compile the project A while compiling/building Project B. At root level i have settings.gradle that included both projects, also if I specify library dependency of project A in gradle script of project B then it works fine. i.e. it compiles project A first and then project B.

However I don’t have library dependency but have header dependencies with project A so it will publish header files to some directory that will linked in project B.

So summary is how to build project A from project B. ( Also how to call some specific task from project A in project B) I hope you got my issue, if not please let me know.

I saw some options like, below code in build.gradle file of project B.

dependencies {

compile project(’:A’)


I tired this, however getting syntax error, Could not find method compile() for arguments [project ‘:A’] on project ‘:B’.

Please let me know how solve this issue for native-binary (CPP) projects.

Thanks Mandar