Skip to content

evanmoran/catch2-bazel

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

catch2-bazel

Bazel support for catch2

(Note: This code is 100% based off of PlacidBox/catch-bazel. All credit to PlacidBox. I initially wanted to update that library with the newest catch, but then realized a new repository was needed so bazel could target either version of catch with http_archive).

Exposes the Catch2 testing framework to Bazel.

Add this to your WORKSPACE file:

http_archive(
    name = "catch2",
    url = "https://github.com/evanmoran/catch2-bazel/archive/v2.2.3.tar.gz",
    strip_prefix = "catch2-bazel-2.2.3",
)

Then add @catch2//:main to the deps on cc_test rules, like:

cc_test(
    name = "my_test",
    srcs = ["my_test.cpp"],
    deps = ["@catch2//:main"],
)

Use @catch2//:catch2 as your dependency if you need to write your own main. This target only exposes the catch2.hpp header.

See the PlacidBox example project for code-in-action in catch 1.X.Y versions.