From e7a31da01b7a19e5bc328ecee78cae1f190c9c27 Mon Sep 17 00:00:00 2001 From: Wunkolo Date: Sat, 4 Apr 2026 16:39:11 -0700 Subject: [PATCH] cmake: Allow Catch test discovery Allows individual unit-tests to be discovered, tested, and debugged by IDEs without having to run _all_ of the unit-tests just to debug one specific test. --- externals/CMakeLists.txt | 1 + src/tests/CMakeLists.txt | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/externals/CMakeLists.txt b/externals/CMakeLists.txt index ffcae42f6..50706a057 100644 --- a/externals/CMakeLists.txt +++ b/externals/CMakeLists.txt @@ -60,6 +60,7 @@ if (ENABLE_TESTS) add_subdirectory(catch2) endif() target_link_libraries(catch2 INTERFACE Catch2::Catch2WithMain) + include(Catch) endif() # Crypto++ diff --git a/src/tests/CMakeLists.txt b/src/tests/CMakeLists.txt index d35e6ba21..027609c26 100644 --- a/src/tests/CMakeLists.txt +++ b/src/tests/CMakeLists.txt @@ -36,6 +36,10 @@ if (ENABLE_LIBRETRO) endif() add_test(NAME tests COMMAND tests) +if(NOT ANDROID) + catch_discover_tests(tests) +endif() + if (CITRA_USE_PRECOMPILED_HEADERS) target_precompile_headers(tests PRIVATE precompiled_headers.h)