aboutsummaryrefslogtreecommitdiff
path: root/third_party/googletest/BUILD.gn
blob: 079df85959e06b6883db64ca76ec7a64159d45f2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
# Copyright 2018 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

import("//build_overrides/build.gni")

if (build_with_chromium) {
  source_set("gmock") {
    testonly = true
    public_configs = [ "//build/config/compiler:default_include_dirs" ]
    public_deps = [
      "//third_party/googletest:gmock",
    ]
  }

  source_set("gtest") {
    testonly = true
    public_configs = [ "//build/config/compiler:default_include_dirs" ]
    public_deps = [
      "//third_party/googletest:gtest",
    ]
  }

  source_set("gtest_main") {
    testonly = true
    public_configs = [ "//build/config/compiler:default_include_dirs" ]
    public_deps = [
      "//third_party/googletest:gtest_main",
    ]
  }
} else {
  config("gmock_config") {
    visibility = [ ":*" ]

    cflags_cc = [
      # issue/15: GMock does not support the override keyword.
      "-Wno-inconsistent-missing-override",
    ]
    if (is_clang) {
      cflags_cc += [ "-Wno-exit-time-destructors" ]
    }

    include_dirs = [ "src/googlemock/include" ]
  }

  config("gtest_config") {
    visibility = [ ":*" ]

    include_dirs = [ "src/googletest/include" ]

    cflags_cc = []
    if (is_clang) {
      cflags_cc += [ "-Wno-exit-time-destructors" ]
    }
  }

  source_set("gmock") {
    testonly = true
    sources = [
      "src/googlemock/include/gmock.h",
      "src/googlemock/src/gmock-all.cc",
    ]

    public_configs = [
      ":gmock_config",
      ":gtest_config",
    ]

    include_dirs = [ "src/googlemock" ]
  }

  source_set("gtest") {
    testonly = true
    sources = [
      "src/googletest/include/gtest.h",
      "src/googletest/src/gtest-all.cc",
    ]

    public_configs = [ ":gtest_config" ]

    include_dirs = [ "src/googletest" ]
  }

  source_set("gtest_main") {
    testonly = true
    sources = [
      "src/googletest/src/gtest_main.cc",
    ]
    deps = [
      ":gtest",
    ]
  }
}