cc_project_template_bazel

A Bazel, ninja, and googletest-based C++ project template
git clone https://git.bracken.jp/cc_project_template_bazel.git
Log | Files | Refs | README | LICENSE

BUILD (852B)


      1 package(default_visibility = ["//visibility:public"])
      2 
      3 cc_library(
      4     name = "foolib",
      5     srcs = [
      6         "bar.cc",
      7         "foo.cc",
      8     ],
      9     hdrs = [
     10         "bar.h",
     11         "foo.h",
     12     ],
     13     deps = [
     14         "@com_google_absl//absl/strings",
     15     ],
     16     visibility = ["//foobar:__pkg__"],
     17 )
     18 
     19 cc_binary(
     20     name = "foobar",
     21     srcs = ["main.cc"],
     22     linkopts = ["-lm"],
     23     deps = [":foolib"],
     24 )
     25 
     26 cc_test(
     27     name = "foobar_test",
     28     srcs = [
     29         "bar_test.cc",
     30         "foo_test.cc",
     31     ],
     32     linkopts = ["-lm"],
     33     deps = [
     34         "@com_google_googletest//:gtest_main",
     35         ":foolib",
     36     ],
     37 )
     38 
     39 #executable("foo_tests") {
     40 #  testonly = true
     41 #
     42 #  sources = [
     43 #    "bar_test.cc",
     44 #    "foo_test.cc",
     45 #  ]
     46 #  deps = [
     47 #    ":foo_srcs",
     48 #    "//third_party/googletest:gtest",
     49 #    "//third_party/googletest:gtest_main",
     50 #  ]
     51 #}