cmake_policy(SET CMP0054 NEW)

set(utilSources
    gtestenv.hpp
    gtestenv.cpp
    event_listener.hpp
    event_monitor.hpp
    event_receiver.hpp
    player_listener.hpp
    callback_monitor.cpp
    callback_monitor.hpp
    player_error_monitor.hpp
    player_error_monitor.cpp
    state_change_monitor.hpp
    state_change_monitor.cpp
    player_state_hash.hpp
    player_state_machine.hpp
    player_state_machine.cpp
    player_state_timer.hpp
    player_state_timer.cpp
    player_timeout_monitor.hpp
    quality_monitor.hpp
    quality_monitor.cpp
    test_util.hpp
    test_util.cpp
    time_util.hpp
    timed_test_runner.hpp
    timed_test_runner.cpp
)

if(
    NOT TARGET_PLATFORM STREQUAL "Android" AND
    NOT TARGET_PLATFORM STREQUAL "PS4" AND
    NOT TARGET_PLATFORM STREQUAL "WinStore" AND
    NOT TARGET_PLATFORM STREQUAL "Win64" AND
    NOT TARGET_PLATFORM STREQUAL "XboxOne" AND
    NOT TARGET_PLATFORM STREQUAL "Web"
  )
  list(APPEND utilSources
    backtrace.hpp
    backtrace.cpp
    signalhandler.hpp
    signalhandler.cpp
  )
endif()

add_library(testutil ${utilSources})
target_include_directories(testutil PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})

target_link_libraries(testutil json11 gtest testenv)
set_folder_property(testutil)
