cmake: support standard ctest option

This commit is contained in:
Alexandre Bouvier 2022-11-24 09:09:19 +01:00 committed by merry
parent 300046b60b
commit 6ac0b249f7
2 changed files with 7 additions and 2 deletions

View file

@ -8,12 +8,14 @@ if (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
set(MASTER_PROJECT ON) set(MASTER_PROJECT ON)
endif() endif()
include(CMakeDependentOption)
# Dynarmic project options # 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_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_ENABLE_NO_EXECUTE_SUPPORT "Enables support for systems that require W^X" OFF)
option(DYNARMIC_FATAL_ERRORS "Errors are fatal" OFF) option(DYNARMIC_FATAL_ERRORS "Errors are fatal" OFF)
option(DYNARMIC_IGNORE_ASSERTS "Ignore asserts" OFF) option(DYNARMIC_IGNORE_ASSERTS "Ignore asserts" OFF)
option(DYNARMIC_TESTS "Build tests" ${MASTER_PROJECT}) cmake_dependent_option(DYNARMIC_TESTS "Build tests" ${MASTER_PROJECT} "NOT DEFINED BUILD_TESTING" "${BUILD_TESTING}")
option(DYNARMIC_TESTS_USE_UNICORN "Enable fuzzing tests against unicorn" OFF) 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_LLVM "Support disassembly of jitted x86_64 code using LLVM" OFF)
option(DYNARMIC_USE_PRECOMPILED_HEADERS "Use precompiled headers" ON) option(DYNARMIC_USE_PRECOMPILED_HEADERS "Use precompiled headers" ON)
@ -155,7 +157,7 @@ add_subdirectory(externals)
# Dynarmic project files # Dynarmic project files
add_subdirectory(src/dynarmic) add_subdirectory(src/dynarmic)
if (DYNARMIC_TESTS) if (DYNARMIC_TESTS)
enable_testing(true) enable_testing()
add_subdirectory(tests) add_subdirectory(tests)
endif() endif()

View file

@ -7,6 +7,9 @@ endif()
# Allow options shadowing with normal variables when subproject use old cmake policy # Allow options shadowing with normal variables when subproject use old cmake policy
set(CMAKE_POLICY_DEFAULT_CMP0077 NEW) set(CMAKE_POLICY_DEFAULT_CMP0077 NEW)
# Disable tests in all externals supporting the standard option name
set(BUILD_TESTING OFF)
# For libraries that already come with a CMakeLists file, # For libraries that already come with a CMakeLists file,
# simply add the directory to that file as a subdirectory # simply add the directory to that file as a subdirectory
# to have CMake automatically recognize them. # to have CMake automatically recognize them.