add_library(test_utils STATIC 
    test_utils/TestCase.h
    test_utils/TestCaseRunner.cpp
    )

target_include_directories(test_utils PUBLIC
                          "${CMAKE_CURRENT_SOURCE_DIR}/test_utils"
                          )

list(APPEND TestFiles 
            audio/TestAudioWriter.cpp
            audio/TestMidiReader.cpp
            database/TestDatabase.cpp
            graphics/TestOpenGlRendering.cpp
            graphics/TestRasterizer.cpp
            ipc/TestDbus.cpp
            image/TestPngWriter.cpp
            publishing/TestPdfWriter.cpp
            video/TestVideoDecoder.cpp
            web/TestMarkdownParser.cpp
            web/TestXmlParser.cpp)
            
list(APPEND TestNames
            TestAudioWriter
            TestMidiReader
            TestDatabase
            TestOpenGlRendering
            TestRasterizer
            TestDbus
            TestPngWriter
            TestPdfWriter
            TestVideoDecoder
            TestMarkdownParser
            TestXmlParser)          

find_package(PkgConfig)            
pkg_check_modules(DBUS REQUIRED dbus-1)
include_directories(${DBUS_INCLUDE_DIRS})
link_directories(${DBUS_LIBRARY_DIRS})

foreach(TestFile TestName IN ZIP_LISTS TestFiles TestNames)
    add_executable(${TestName}  ${TestFile})
    target_link_libraries(${TestName} PUBLIC core network image publishing video database geometry audio graphics web client test_utils ${DBUS_LIBRARIES})
endforeach()


add_executable(test_runner test_runner.cpp)
target_link_libraries(test_runner PUBLIC core network database geometry audio graphics web client)