[英]Gradle with C++: How to change compiler options?
我开始与Gradle合作,并完成了一些工作。 构建生成文件“ options.txt”:
-x
c++
-c
-I
/path/to/project/src/main/headers
-I
/path/to/project/src/hello/headers
-m64
他们为我选择编译器选项很酷,但是例如,我想使用-std = c ++ 17以及-Wall和-Wextra来编译我的东西。 那么如何将这些标志添加到g ++选项中呢?
只需在build.gradle中的“模型”内部添加以下内容:
toolChains {
gcc(Gcc) {
eachPlatform {
cppCompiler.withArguments { args ->
args << "-std=c++17"
}
cppCompiler.withArguments { args ->
args << "-Wall"
}
cppCompiler.withArguments { args ->
args << "-Wextra"
}
}
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.