diff --git a/com.ibm.wala.cast/build.gradle b/com.ibm.wala.cast/build.gradle index 3cd076320..284f753a2 100644 --- a/com.ibm.wala.cast/build.gradle +++ b/com.ibm.wala.cast/build.gradle @@ -69,11 +69,22 @@ model { exportedHeaders.srcDirs = ["$cSourceDir/include"] lib library: 'jdk' } - binaries.all { - switch ("$targetPlatform.operatingSystem.name/$targetPlatform.architecture.name") { - case 'linux/x86-64': - // TODO: compute path on following line from 'jdk' library properties somehow - linker.args '-Wl,-rpath', "$currentJavaHome/jre/lib/amd64/server" + binaries { + withType(StaticLibraryBinarySpec) { + buildable = false + } + withType(SharedLibraryBinarySpec) { + switch ("$targetPlatform.operatingSystem.name/$targetPlatform.architecture.name") { + case 'linux/x86-64': + $ + .repositories['libs'] + .resolveLibrary('jdk') + .binaries + .withType(SharedLibraryBinary) + .findResults { it.sharedLibraryLinkFile } + *.parentFile + .each { linker.args "-Wl,-rpath=$it" } + } } } }