GN, cflags -= ["xxx"] Can not remove default cflags
Reported by
sainim...@gmail.com,
Jan 11 2018
|
||||
Issue description
UserAgent: Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.90 Safari/537.36
Steps to reproduce the problem:
executable("NihaoSkia") {
testonly = true
if (is_win) {
cflags -= [
"/WX", # Treat warnings as errors.
]
}
defines = [
"WIN32"
]
sources = [
"HelloWorld.cpp",
]
include_dirs = [
"E:\Fts\Proj\Test\DFVision_Proj\DFVisionConsole_Common\include",
]
deps = [
"//:flags",
"//:gpu_tool_utils",
"//:sk_app",
"//:skia",
"//:tool_utils",
"//:views",
]
# ldflags -= [ "/SUBSYSTEM:CONSOLE" ]
# ldflags += [ "/SUBSYSTEM:WINDOWS" ]
}
---------------------------------
I'm using -= oporator in my BUILD.gn, I want to remove some default cflags and ldflags, but "-=" does not work.
What is the expected behavior?
cflags -= ["xxx"] operation removes "xxx" from inherited cflags
What went wrong?
The error messages:
ERROR at //NihaoSkia/src/BUILD.gn:8:5: Undefined identifier.
cflags -= [
^-----
See //BUILD.gn:2017:5: which caused the file to be included.
"//NihaoSkia/src:NihaoSkia",
^--------------------------
ninja: error: rebuilding 'build.ninja': subcommand failed
Did this work before? N/A
Chrome version: 60.0.3112.90 Channel: n/a
OS Version: 10.0
Flash Version:
,
Jan 30 2018
Issue 806647 has been merged into this issue.
,
Jun 8 2018
thakis@ can you respond and close this issue out.
,
Jun 8 2018
See `gn help configs`. If you need to remove a cflag, it needs to be in its own config. For /WX you're in luck: If you set `treat_warnings_as_errors = false` in your args.gn, we won't pass that for any target. (But we always want /WX for all targets in the official chromium build.)
,
Jun 8 2018
|
||||
►
Sign in to add a comment |
||||
Comment 1 by sainim...@gmail.com
, Jan 29 2018