C++ build dependencies

I am in the process of starting a c++ library and would love to use gradle as the build tool. One question I have is what is the proper way to add a third party library as a dependency? All the examples assume that it exists in some maven like repo from what I can tell.

We’re currently working on improving the C++ support, but Gradle-1.7 has a lot of good features that may help you get started.

Regarding using 3rd party libraries, we haven’t yet built in any good support. However, I experimented with a workaround that seems to do the job for pre-existing dependencies:

def externalLib = new ExternalLibrary(project.files('src/lib/headers'), project.files('helloSharedLibrary/libhello.dylib'))
  executables {
 main {
     source cpp.sourceSets.exe
     binaries.all {
         lib externalLib
     }
 }
}
  class ExternalLibrary implements NativeDependencySet {
    final FileCollection headerDirectories
    final FileCollection binaryFiles
      ExternalLibrary(FileCollection headerDirctories, FileCollection binaryFiles) {
        this.headerDirectories = headerDirctories
        this.binaryFiles = binaryFiles
    }
      FileCollection getIncludeRoots() {
        return headerDirectories;
    }
   // The files required at link time (*.dll on windows)
    FileCollection getLinkFiles() {
        return binaryFiles;
    }
      // The files required at runtime (*.lib on windows)
    // Used with 'gradle installMainExecutable'
    FileCollection getRuntimeFiles() {
        return binaryFiles;
    }
}

If you want to use an empty file collection for getRuntimeFiles(), use ‘project.files()’.

Gotcha, I will give this try. Do you know if at some point in the future if there will be the capability to add a third party dep and have gradle scan for common locations on your system such as ( “/usr/include”, “/usr/lib”) for the actual dependency?