1 # Copyright 2014 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.
5 config("gtest_config") {
8 "//testing/gmock:*", # gmock also shares this config.
12 # In order to allow regex matches in gtest to be shared between Windows
13 # and other systems, we tell gtest to always use it's internal engine.
14 "GTEST_HAS_POSIX_RE=0",
16 # Chrome doesn't support / require C++11, yet.
20 # Gtest headers need to be able to find themselves.
21 include_dirs = [ "include" ]
24 cflags = [ "/wd4800" ] # Unused variable warning.
29 # gtest isn't able to figure out when RTTI is disabled for gcc
30 # versions older than 4.3.2, and assumes it's enabled. Our Mac
31 # and Linux builds disable RTTI, and cannot guarantee that the
32 # compiler will be 4.3.2. or newer. The Mac, for example, uses
33 # 4.2.1 as that is the latest available on that platform. gtest
34 # must be instructed that RTTI is disabled here, and for any
35 # direct dependents that might include gtest headers.
42 # We want gtest features that use tr1::tuple, but we currently
43 # don't support the variadic templates used by libstdc++'s
44 # implementation. gtest supports this scenario by providing its
45 # own implementation but we must opt in to it.
46 "GTEST_USE_OWN_TR1_TUPLE=1",
48 # GTEST_USE_OWN_TR1_TUPLE only works if GTEST_HAS_TR1_TUPLE is set.
49 # gtest r625 made it so that GTEST_HAS_TR1_TUPLE is set to 0
50 # automatically on android, so it has to be set explicitly here.
51 "GTEST_HAS_TR1_TUPLE=1",
56 config("gtest_direct_config") {
58 defines = [ "UNIT_TEST" ]
61 config("gtest_warnings") {
62 if (is_win && is_clang) {
63 # The Mutex constructor initializer list in gtest-port.cc is incorrectly
65 # https://groups.google.com/d/msg/googletestframework/S5uSV8L2TX8/U1FaTDa6J6sJ.
66 cflags = [ "-Wno-reorder" ]
70 static_library("gtest") {
71 # TODO http://crbug.com/412064 enable this flag all the time.
72 testonly = !is_component_build
74 "include/gtest/gtest-death-test.h",
75 "include/gtest/gtest-message.h",
76 "include/gtest/gtest-param-test.h",
77 "include/gtest/gtest-printers.h",
78 "include/gtest/gtest-spi.h",
79 "include/gtest/gtest-test-part.h",
80 "include/gtest/gtest-typed-test.h",
81 "include/gtest/gtest.h",
82 "include/gtest/gtest_pred_impl.h",
83 "include/gtest/internal/gtest-death-test-internal.h",
84 "include/gtest/internal/gtest-filepath.h",
85 "include/gtest/internal/gtest-internal.h",
86 "include/gtest/internal/gtest-linked_ptr.h",
87 "include/gtest/internal/gtest-param-util-generated.h",
88 "include/gtest/internal/gtest-param-util.h",
89 "include/gtest/internal/gtest-port.h",
90 "include/gtest/internal/gtest-string.h",
91 "include/gtest/internal/gtest-tuple.h",
92 "include/gtest/internal/gtest-type-util.h",
94 #"gtest/src/gtest-all.cc", # Not needed by our build.
95 "../multiprocess_func_list.cc",
96 "../multiprocess_func_list.h",
98 "src/gtest-death-test.cc",
99 "src/gtest-filepath.cc",
100 "src/gtest-internal-inl.h",
102 "src/gtest-printers.cc",
103 "src/gtest-test-part.cc",
104 "src/gtest-typed-test.cc",
108 if (is_mac || is_ios) {
110 set_sources_assignment_filter([])
115 "../platform_test_mac.mm",
117 set_sources_assignment_filter(sources_assignment_filter)
122 "../coverage_util_ios.cc",
123 "../coverage_util_ios.h",
127 include_dirs = [ "." ]
129 all_dependent_configs = [ ":gtest_config" ]
130 public_configs = [ ":gtest_direct_config" ]
132 configs -= [ "//build/config/compiler:chromium_code" ]
134 "//build/config/compiler:no_chromium_code",
136 # Must be after no_chromium_code for warning flags to be ordered correctly.
141 source_set("gtest_main") {
142 # TODO http://crbug.com/412064 enable this flag all the time.
143 testonly = !is_component_build