I want to create a Bazel C++ project with gtest for unit tests.
What is the minimal setup?
(I only have Bazel installed on my computer and I am running under Linux)
This is even easier now that googletest provides a BUILD file:
load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")
git_repository(
name = "gtest",
remote = "https://github.com/google/googletest",
branch = "v1.10.x",
)
cc_test (
name = "hello_test",
srcs = [
"hello_test.cc",
],
deps = [
"@gtest//:gtest",
"@gtest//:gtest_main" # Only if hello_test.cc has no main()
],
)