From b45ad59d2abdd075c73ee08b06e8906b902f1f56 Mon Sep 17 00:00:00 2001 From: Dennis Hezel Date: Sun, 6 Oct 2024 17:57:53 +0200 Subject: [PATCH] chore: Fix discovering tests for CTest --- CMakeLists.txt | 2 +- test/CMakeLists.txt | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d857aa3..deb4e8e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -20,8 +20,8 @@ add_subdirectory(src) if(CNTGS_BUILD_TESTS) include("${CMAKE_CURRENT_LIST_DIR}/cmake/CntgsInstallGitHooks.cmake") - find_package(doctest REQUIRED) enable_testing() + find_package(doctest REQUIRED) include(doctest) add_subdirectory(test) add_subdirectory(example) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index d775b09..8781200 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -69,6 +69,10 @@ function(cntgs_add_test _cntgs_name _cntgs_disassembly_file) $) target_precompile_headers(${_cntgs_name} PRIVATE "utils/precompiledHeader.hpp") + + if(CNTGS_DISCOVER_TESTS) + doctest_discover_tests(${_cntgs_name}) + endif() endfunction() set(CNTGS_TEST_SOURCE_FILES