CMake: Run unit test during build if requested

This commit is contained in:
Megamouse 2025-04-29 21:40:22 +02:00
parent 3b61613d1b
commit 39247fcbc1
2 changed files with 9 additions and 0 deletions

View file

@ -34,6 +34,7 @@ option(USE_SYSTEM_OPENCV "Prefer system OpenCV instead of the builtin one" ON)
option(HAS_MEMORY_BREAKPOINTS "Add support for memory breakpoints to the interpreter" OFF)
option(USE_LTO "Use LTO for building" ON)
option(BUILD_RPCS3_TESTS "Build RPCS3 unit tests." OFF)
option(RUN_RPCS3_TESTS "Run RPCS3 unit tests. Requires BUILD_RPCS3_TESTS" OFF)
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/buildfiles/cmake")

View file

@ -239,4 +239,12 @@ if(BUILD_RPCS3_TESTS)
include(GoogleTest)
gtest_discover_tests(rpcs3_test)
if(RUN_RPCS3_TESTS)
add_custom_target(run_tests
ALL
COMMAND ${CMAKE_CTEST_COMMAND} -j -VV --output-on-failure
DEPENDS rpcs3_test
)
endif()
endif()