C++ project with Bazel and GTest
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: 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) 回答1: The project structure is: Files related to Bazel+GTest WORKSPACE There you download gtest from github: new_git_repository( name = "googletest", build_file = "gmock.BUILD", remote = "https://github.com/google/googletest", tag = "release-1.8.0", ) You define a gmock BUILD file defined below: gmock.BUILD This BUILD file is in charge of compiling gtest/gmock: cc_library( name =