Index: tools/gn/docs/cookbook.md |
diff --git a/tools/gn/docs/cookbook.md b/tools/gn/docs/cookbook.md |
index 92bfeb55e1038b96cd552eb69bc44b118e3539d9..cdd6a032b649bba3b4e4479e6abee90ff8cad1c3 100644 |
--- a/tools/gn/docs/cookbook.md |
+++ b/tools/gn/docs/cookbook.md |
@@ -122,6 +122,7 @@ component("base") { |
'sources': [ |
'a.cc', |
'b.cc', |
+ 'c.cc', |
], |
'dependencies': [ |
'<(DEPTH)/base/base.gyp:foo', |
@@ -149,22 +150,26 @@ component("base") { |
``` |
sources = [ |
- "a.cc", |
- "b.cc", |
+ "c.cc", |
] |
deps = [ |
"//base:foo", |
] |
if (is_win) { |
- sources -= [ "a.cc" ] |
- sources += [ "foo.cc" ] |
+ sources += [ |
+ "b.cc", |
+ "foo.cc', |
+ ] |
deps += [ "//base:bar" ] |
} else { |
- sources -= [ "b.cc" ] |
+ sources += [ "a.cc" ] |
} |
``` |
+Note that in GN we prefer to only add files when needed, and don't add all of |
+them at first only to remove them later like in gyp. |
+ |
## Variable mappings |
### Build configuration |