Continuing the discussion from [CPP] Conditional Linking and Excluding:
There’s two things related to prebuild libraries that I noticed through forum discussions and my own experience that people would find useful.
[1] Specifying system libraries
binaries.all {
systemlib lib : 'z' linkage : 'static'
}
Then let Gradle figure out how to add the appropriate linker flags.
[2] GeneratedBy equivalent
Related to: Please clarify: "A library component that is not built by gradle."
This is the case where a library is not built by native means, but still needs to be unpacked by Gradle (or maybe built via external means i.e. make
or scons
). IN this case having the equivalanet of generatedBy which is in souce sets will be useful.
repositories {
libs {
boost {
generatedBy ':other-project:unpackTaskName'
}
Now Gradle should know that before any native compoenent specifying boost
as library is executed it know sit has to run :other-project:unpackTaskName
first.
Maybe you Gradle devs are already working on this, but I thought I would mention them anyway,