# Native common compiler args for all projects

**URL:** <https://discuss.gradle.org/t/native-common-compiler-args-for-all-projects/27279>\
**Category:** Help/Discuss\
**Created:** [June 7, 2018, 9:22pm UTC](https://discuss.gradle.org/t/native-common-compiler-args-for-all-projects/27279 "2018-06-07T21:22:31Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![marcpawl](https://avatars.discourse-cdn.com/v4/letter/m/e480ec/32.png) [@marcpawl](https://discuss.gradle.org/u/marcpawl)\
**Post date:** [June 7, 2018, 9:22pm UTC](https://discuss.gradle.org/t/native-common-compiler-args-for-all-projects/27279/1 "2018-06-07T21:22:31Z")

</div>

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”  
}  
}  
}  
}
