blob: 384eeed580057c796d19cfc7f9f46dc260d1007c [file] [log] [blame]
abarth6fc8ff02016-07-15 15:15:15 -07001# Copyright 2016 Google Inc.
2#
3# Use of this source code is governed by a BSD-style license that can be
4# found in the LICENSE file.
5
mtkleinf037d482016-07-19 08:25:00 -07006template("third_party") {
Brian Osmanc069a572018-06-19 16:05:09 -04007 enabled = !defined(invoker.enabled) || invoker.enabled
mtklein25c81d42016-07-27 13:55:26 -07008 config(target_name + "_public") {
Brian Osmanc069a572018-06-19 16:05:09 -04009 if (enabled) {
10 cflags = []
11 if (defined(invoker.public_defines)) {
12 defines = invoker.public_defines
13 }
14 if (is_win) {
15 include_dirs = invoker.public_include_dirs
16 } else {
17 foreach(dir, invoker.public_include_dirs) {
18 cflags += [
19 "-isystem",
20 rebase_path(dir),
21 ]
22 }
23 }
24 } else {
25 not_needed(invoker, "*")
Mike Klein4b167fc2016-10-11 18:13:53 -040026 }
mtklein25c81d42016-07-27 13:55:26 -070027 }
mtkleinf037d482016-07-19 08:25:00 -070028 source_set(target_name) {
Brian Osmanc069a572018-06-19 16:05:09 -040029 if (enabled) {
30 forward_variables_from(invoker, "*", [ "public_include_dirs" ])
31 public_configs = [ ":" + target_name + "_public" ]
abarth6fc8ff02016-07-15 15:15:15 -070032
Brian Osmanc069a572018-06-19 16:05:09 -040033 # Warnings are just noise if we're not maintaining the code.
34 if (is_win) {
35 cflags = [ "/w" ]
36 } else {
37 cflags = [ "-w" ]
38 }
herbb6318bf2016-09-16 13:29:57 -070039 }
mtkleinf037d482016-07-19 08:25:00 -070040 }
41}
halcanary19a97202016-08-03 15:08:04 -070042
43set_defaults("third_party") {
Mike Kleinc7165c22016-10-12 23:58:06 -040044 configs = default_configs - [ "//gn:warnings" ]
halcanary19a97202016-08-03 15:08:04 -070045}
Mike Klein10d665d2016-11-01 11:46:10 -040046
47template("system") {
48 config(target_name + "_public") {
49 forward_variables_from(invoker, "*", [])
50 }
51 group(target_name) {
52 public_configs = [ ":" + target_name + "_public" ]
53 }
54}