How to integrate native builds with Catch2 (or other testing frameworks)

In a software project that builds a native C++ application (currently using Gradle 4.6), I would like to integrate unit tests written using Catch2 into the build. So far, I haven’t found out the proper way to do this. The guide to building native software and other resources only mention integration of Google Test and CUnit via the respective plugins, which do some stuff behind the scenes.

I suspect there is a generic way to integrate test suites using frameworks other than Google Test and CUnit, and that I probably merely need to know how the

testSuites {
  ...
}

block should look like, but I couldn’t find any hints helping with that.

I guess something like this has been done before, and I would be grateful for a recipe for how to do this properly, or a pointer to a part in the documentation explaining this, in case I missed it.

(Note that I also asked this on Stackoverflow, but the question has been downvoted there for some unexplained reason.)

I feel your confusion @swltr. Both native test suites are pretty lacking in term of support for the specific test frameworks. In the end, you could use any other the two plugins and ensure Catch2 is in the include path either by configuring the CppCompile task or by creating a prebuilt library and adding a dependency from your test suite. I hope this helps you be successful with Catch2 in Gradle.