xref: /aosp_15_r20/external/openscreen/third_party/googletest/BUILD.gn (revision 3f982cf4871df8771c9d4abe6e9a6f8d829b2736)
1# Copyright 2018 The Chromium Authors. All rights reserved.
2# Use of this source code is governed by a BSD-style license that can be
3# found in the LICENSE file.
4
5import("//build_overrides/build.gni")
6
7if (build_with_chromium) {
8  source_set("gmock") {
9    testonly = true
10    public_configs = [
11      "//build/config/compiler:default_include_dirs",
12      "../../build:openscreen_include_dirs",
13    ]
14    public_deps = [ "//third_party/googletest:gmock" ]
15  }
16
17  source_set("gtest") {
18    testonly = true
19    public_configs = [
20      "//build/config/compiler:default_include_dirs",
21      "../../build:openscreen_include_dirs",
22    ]
23    public_deps = [ "//third_party/googletest:gtest" ]
24  }
25
26  source_set("gtest_main") {
27    testonly = true
28    public_configs = [
29      "//build/config/compiler:default_include_dirs",
30      "../../build:openscreen_include_dirs",
31    ]
32    public_deps = [ "//third_party/googletest:gtest_main" ]
33  }
34} else {
35  config("gmock_config") {
36    visibility = [ ":*" ]
37
38    cflags_cc = []
39    if (is_clang) {
40      # NOTE(crbug.com/openscreen/15): GMock does not support the override
41      # keyword.
42      cflags_cc += [
43        "-Wno-exit-time-destructors",
44        "-Wno-inconsistent-missing-override",
45      ]
46    }
47
48    include_dirs = [ "src/googlemock/include" ]
49  }
50
51  config("gtest_config") {
52    visibility = [ ":*" ]
53
54    include_dirs = [ "src/googletest/include" ]
55
56    cflags_cc = []
57    if (is_clang) {
58      cflags_cc += [ "-Wno-exit-time-destructors" ]
59    }
60  }
61
62  source_set("gmock") {
63    testonly = true
64    sources = [
65      "src/googlemock/include/gmock/gmock.h",
66      "src/googlemock/src/gmock-all.cc",
67    ]
68
69    public_configs = [
70      ":gmock_config",
71      ":gtest_config",
72    ]
73
74    public_deps = [ ":gtest" ]
75
76    include_dirs = [ "src/googlemock" ]
77  }
78
79  source_set("gtest") {
80    testonly = true
81    sources = [
82      "src/googletest/include/gtest/gtest.h",
83      "src/googletest/src/gtest-all.cc",
84    ]
85
86    public_configs = [ ":gtest_config" ]
87
88    include_dirs = [ "src/googletest" ]
89  }
90
91  source_set("gtest_main") {
92    testonly = true
93    sources = [ "src/googletest/src/gtest_main.cc" ]
94    deps = [ ":gtest" ]
95  }
96}
97