mirror of
https://github.com/catchorg/Catch2.git
synced 2024-11-04 21:29:54 +01:00
Add bazel support
This commit is contained in:
parent
92f8b01dfa
commit
578f8b8006
15
BUILD.bazel
15
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"],
|
||||
)
|
||||
|
@ -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).
|
||||
|
Loading…
Reference in New Issue
Block a user