Native common compiler args for all projects


(Marc Pawlowsky) #1

I have a big sub-project tree with a combination of C and C++ code on Linux.
I am trying to get all of the projects to use a common set of compiler arguments.

When I compile my subproject the options.txt does not contain my options.

Any idea on how this can be done?
I tried binaries instead of components and withType(SharedLibraryBinarySpec) instead of all.

In my root project I have a build.gradle that contains

/** BROKEN build.gradle compiler options are not sent to subprojects. */
allprojects {
apply plugin: ‘c’
apply plugin: ‘cpp’
apply plugin: ‘google-test-test-suite’
model {
repositories {

}
binaries{
all {
cCompiler.args “-Wall”
cCompiler.args “-Werror”
cCompiler.args “-g”
cppCompiler.args “-Wall”
cppCompiler.args “-Werror”
cppCompiler.args “-g”
cppCompiler.args “-std=c++11”
}
withType(SharedLibraryBinarySpec) {
buildable = false
}
}
platforms {
x86 {
architecture “x86”
}
}
}
}