I tried to globally set compilerArgs
in tasks.withType(CppCompile)
but it was just ignored. How can I compile both of foo.cpp
and bar.cpp
with -pthread
?
Gradle 2.6 with JDK 1.8.0_45 on CentOS 6.6
I tried to globally set compilerArgs
in tasks.withType(CppCompile)
but it was just ignored. How can I compile both of foo.cpp
and bar.cpp
with -pthread
?
Gradle 2.6 with JDK 1.8.0_45 on CentOS 6.6
binaries.withType(NativeBinarySpec) {
if (toolChain in Gcc) {
cppCompiler.args '-pthread'
linker.args '-lpthread'
}
}
@tonyabbott Works like a charm! But how did you find out you could use cppCompiler
with NativeBinarySpec
? I only found linker
in the document.
Think I must have found it in an example somewhere, but as I understand it the binary is also decorated with GccPlatformToolChain because it is being compiled with the Gcc toolchain, hence the cppCompiler property.