Progmasoft Git

catch3

Progmasoft Catch3: an independently maintained C++17 test framework with a parallel runner, property checks, snapshots and structured results.

Clonegit clone https://git.progmasoft.com/catch3

Add bazel support

Commit
578f8b80068d5cb578e271e4ccb01a59117a9733
Author
Florian Berchtold ·
Committer
Martin Hořeňovský
Parents
92f8b01dfa24

Files · Download .tar.gz

Changes

 BUILD.bazel           | 15 +++++++++++----
 docs/slow-compiles.md | 15 +++++++++++++++
 2 files changed, 26 insertions(+), 4 deletions(-)

diff --git a/BUILD.bazel b/BUILD.bazel
index 2a412a8e..229c550e 100644
--- a/BUILD.bazel
+++ b/BUILD.bazel
@@ -3,8 +3,15 @@ load("@rules_cc//cc:defs.bzl", "cc_library")
 
 # Header-only rule to export catch2/catch.hpp.
 cc_library(
-  name = "catch2",
-  hdrs = ["single_include/catch2/catch.hpp"],
-  visibility = ["//visibility:public"],
-  includes = ["single_include/"],
+    name = "catch2",
+    hdrs = ["single_include/catch2/catch.hpp"],
+    includes = ["single_include/"],
+    visibility = ["//visibility:public"],
+)
+
+cc_library(
+    name = "catch2_with_main",
+    srcs = ["src/catch_with_main.cpp"],
+    visibility = ["//visibility:public"],
+    deps = ["//:catch2"],
 )
diff --git a/docs/slow-compiles.md b/docs/slow-compiles.md
index 8dcbf6d2..63e628fb 100644
--- a/docs/slow-compiles.md
+++ b/docs/slow-compiles.md
@@ -75,6 +75,7 @@ implementation and C++ linking limitations.
 As with the `Catch2` target, the `Catch2WithMain` CMake target can be used
 either from a subdirectory, or from installed build.
 
+
 ### CMake
 ```cmake
 add_executable(tests-factorial tests-factorial.cpp)
@@ -82,6 +83,20 @@ add_executable(tests-factorial tests-factorial.cpp)
 target_link_libraries(tests-factorial Catch2::Catch2WithMain)
 ```
 
+### bazel
+```python
+cc_test(
+    name = "hello_world_test",
+    srcs = [
+        "test/hello_world_test.cpp",
+    ],
+    deps = [
+        "lib_hello_world",
+        "@catch2//:catch2_with_main",
+    ],
+)
+```
+
 
 ## Other possible solutions
 You can also opt to sacrifice some features in order to speed-up Catch's compilation times. For details see the [documentation on Catch's compile-time configuration](configuration.md#other-toggles).