Don’t link targets with main function against //:gtest_main

This works only because the linker discards the main function from the
//:gtest_main library, otherwise the symbol would be duplicated.
This commit is contained in:
Philipp Stephani 2025-11-04 19:41:46 +01:00
parent 6ec14dfd8c
commit ae2b601bea

View File

@ -125,7 +125,7 @@ cc_test(
name = "googletest-listener-test", name = "googletest-listener-test",
size = "small", size = "small",
srcs = ["googletest-listener-test.cc"], srcs = ["googletest-listener-test.cc"],
deps = ["//:gtest_main"], deps = ["//:gtest"],
) )
cc_test( cc_test(
@ -358,7 +358,7 @@ cc_test(
name = "gtest_skip_in_environment_setup_test", name = "gtest_skip_in_environment_setup_test",
size = "small", size = "small",
srcs = ["gtest_skip_in_environment_setup_test.cc"], srcs = ["gtest_skip_in_environment_setup_test.cc"],
deps = ["//:gtest_main"], deps = ["//:gtest"],
) )
py_test( py_test(
@ -417,7 +417,7 @@ cc_binary(
name = "googletest-catch-exceptions-no-ex-test_", name = "googletest-catch-exceptions-no-ex-test_",
testonly = 1, testonly = 1,
srcs = ["googletest-catch-exceptions-test_.cc"], srcs = ["googletest-catch-exceptions-test_.cc"],
deps = ["//:gtest_main"], deps = ["//:gtest"],
) )
cc_binary( cc_binary(
@ -425,7 +425,7 @@ cc_binary(
testonly = 1, testonly = 1,
srcs = ["googletest-catch-exceptions-test_.cc"], srcs = ["googletest-catch-exceptions-test_.cc"],
copts = ["-fexceptions"], copts = ["-fexceptions"],
deps = ["//:gtest_main"], deps = ["//:gtest"],
) )
py_test( py_test(