Skip to content

Instantly share code, notes, and snippets.

@nodakai
Last active August 29, 2015 14:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nodakai/b612a7f58c840cda0fb0 to your computer and use it in GitHub Desktop.
Save nodakai/b612a7f58c840cda0fb0 to your computer and use it in GitHub Desktop.
Minimal Gradle C++ project with multiple references to external libraries
apply plugin: 'cpp'
model {
components {
main(NativeExecutableSpec) {
sources {
cpp {
source {
srcDirs '.'
include 'foo.cpp'
}
}
}
binaries {
all {
lib library: 'm'
lib library: 'rt'
}
}
}
}
repositories {
libs(PrebuiltLibraries) {
m {
binaries.withType(SharedLibraryBinary) {
sharedLibraryFile = file("/usr/lib64/libm.so")
}
}
rt {
binaries.withType(SharedLibraryBinary) {
sharedLibraryFile = file("/usr/lib64/librt.so")
}
}
}
}
}
int main() { }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment