Skip to content

Commit

Permalink
Create a BUILD file for compatibility with bazel
Browse files Browse the repository at this point in the history
With this change, it's much easier for bazel projects to depend on
Catch. They just need to add:
  - In the workspace:
  ```
http_archive(
    name = "com_github_catchorg_catch2",
    urls = ["https://github.com/catchorg/Catch2/archive/v2.12.1.tar.gz"],
    strip_prefix = "Catch2-2.12.1",
    sha256 = "e5635c082282ea518a8dd7ee89796c8026af8ea9068cd7402fb1615deacd91c3",
)
```
  Or the appropriate version/sha256.
  - For the tests, assuming that `test_main.cc` contains the
  `CATCH_CONFIG_MAIN`:
  ```
cc_library(
    name = "test_main",
    srcs = ["test_main.cc"],
    deps = ["@com_github_catchorg_catch2//:catch2"],
)
```
  • Loading branch information
nitnelave authored and horenmar committed May 17, 2020
1 parent f133277 commit 0e9bae1
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,4 @@ Build
cmake-build-*
benchmark-dir
.conan/test_package/build
bazel-*
10 changes: 10 additions & 0 deletions BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Load the cc_library rule.
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/"],
)
Empty file added WORKSPACE
Empty file.

0 comments on commit 0e9bae1

Please sign in to comment.