From 46e5f4ee977ee86f860ade58c38f30f6fe601884 Mon Sep 17 00:00:00 2001 From: Alexandre Bouvier Date: Sat, 31 Dec 2022 19:43:35 +0100 Subject: [PATCH] cmake: use ctest module --- CMakeLists.txt | 7 ++++--- externals/CMakeLists.txt | 2 -- tests/CMakeLists.txt | 2 +- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1253dfa0..920cf2ba 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,14 +8,16 @@ if (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR) set(MASTER_PROJECT ON) endif() -include(CMakeDependentOption) +if (MASTER_PROJECT) + include(CTest) +endif() # Dynarmic project options option(DYNARMIC_ENABLE_CPU_FEATURE_DETECTION "Turning this off causes dynarmic to assume the host CPU doesn't support anything later than SSE3" ON) option(DYNARMIC_ENABLE_NO_EXECUTE_SUPPORT "Enables support for systems that require W^X" OFF) option(DYNARMIC_FATAL_ERRORS "Errors are fatal" OFF) option(DYNARMIC_IGNORE_ASSERTS "Ignore asserts" OFF) -cmake_dependent_option(DYNARMIC_TESTS "Build tests" ${MASTER_PROJECT} "NOT DEFINED BUILD_TESTING" "${BUILD_TESTING}") +option(DYNARMIC_TESTS "Build tests" ${BUILD_TESTING}) option(DYNARMIC_TESTS_USE_UNICORN "Enable fuzzing tests against unicorn" OFF) option(DYNARMIC_USE_LLVM "Support disassembly of jitted x86_64 code using LLVM" OFF) option(DYNARMIC_USE_PRECOMPILED_HEADERS "Use precompiled headers" ON) @@ -154,7 +156,6 @@ add_subdirectory(externals) # Dynarmic project files add_subdirectory(src/dynarmic) if (DYNARMIC_TESTS) - enable_testing() add_subdirectory(tests) endif() diff --git a/externals/CMakeLists.txt b/externals/CMakeLists.txt index 928441dd..85fae1a4 100644 --- a/externals/CMakeLists.txt +++ b/externals/CMakeLists.txt @@ -19,8 +19,6 @@ set(BUILD_TESTING OFF) if (NOT TARGET Catch2::Catch2WithMain) if (DYNARMIC_TESTS) add_subdirectory(catch EXCLUDE_FROM_ALL) - list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/externals/catch/extras") - set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} PARENT_SCOPE) endif() endif() diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index b667aca6..20f96588 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -105,6 +105,6 @@ create_target_directory_groups(dynarmic_tests) target_link_libraries(dynarmic_tests PRIVATE dynarmic Boost::boost Catch2::Catch2WithMain fmt::fmt merry::mcl) target_include_directories(dynarmic_tests PRIVATE . ../src) target_compile_options(dynarmic_tests PRIVATE ${DYNARMIC_CXX_FLAGS}) -target_compile_definitions(dynarmic_tests PRIVATE FMT_USE_USER_DEFINED_LITERALS=1 CATCH_CONFIG_ENABLE_BENCHMARKING=1) +target_compile_definitions(dynarmic_tests PRIVATE FMT_USE_USER_DEFINED_LITERALS=1) add_test(dynarmic_tests dynarmic_tests --durations yes)