CPMAddPackage("gh:catchorg/Catch2@3.7.1")

list(APPEND CMAKE_MODULE_PATH ${catch2_SOURCE_DIR}/extras)

add_executable(CoreTests
  ../backends/SchemaFixture.hpp
  logger/LoggerTest.cpp
  object/ObjectCacheTest.cpp
  object/ObjectTest.cpp
  object/PrimaryKeyResolverTest.cpp
  object/RepositoryTest.cpp
  utils/BasicTypeToVisitorTest.cpp
  utils/ConvertTest.cpp
  utils/DefaultTypeTraitsTest.cpp
  utils/DependencyInjectionTest.cpp
  utils/FieldAttributeTest.cpp
  utils/IdentifierTest.cpp
  utils/IsDatabasePrimitiveTest.cpp
  utils/MessageBusTest.cpp
  utils/PrimaryKeyAccessorTest.cpp
  utils/ResultTest.cpp
  utils/StringTest.cpp
  utils/ThreadPoolTest.cpp
  utils/VersionTest.cpp
)

target_link_libraries(CoreTests matador-core Catch2::Catch2WithMain)

target_include_directories(CoreTests
  PUBLIC
  ${CMAKE_SOURCE_DIR}/test/models}
)

#if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
#  target_compile_options(CoreTests PRIVATE -coverage)
#  target_link_options(CoreTests PRIVATE -coverage)
#endif ()

add_test(NAME CoreTests COMMAND CoreTests)
