Add: unit test functionality using catch2

(cherry picked from commit 43a7e54067)
This commit is contained in:
Rubidium
2023-04-10 19:02:31 +02:00
committed by Jonathan G Rennison
parent f92a96dad2
commit 73d7052732
12 changed files with 876 additions and 647 deletions

View File

@@ -253,6 +253,7 @@ if(OPTION_PACKAGE_DEPENDENCIES)
set(CMAKE_BUILD_WITH_INSTALL_RPATH ON)
endif()
include(CTest)
include(SourceList)
# Needed by rev.cpp
@@ -264,6 +265,9 @@ include(MSVCFilters)
add_executable(openttd WIN32 ${GENERATED_SOURCE_FILES})
set_target_properties(openttd PROPERTIES OUTPUT_NAME "${BINARY_NAME}")
add_executable(openttd_test)
set_target_properties(openttd_test PROPERTIES EXCLUDE_FROM_ALL TRUE)
# All other files are added via target_sources()
set(host_tools_list strgen settingsgen)
@@ -327,6 +331,9 @@ target_link_libraries(openttd
openttd::binfiles
Threads::Threads
)
target_link_libraries(openttd_test)
include(Catch)
catch_discover_tests(openttd_test)
if(HAIKU)
target_link_libraries(openttd "be" "network" "midi")