# CMake script for PAPPSOms++ library # Author: Olivier Langella # Created: 03/03/2015 from the CMakeLists file of the Bio++ project #CTEST_OUTPUT_ON_FAILURE=TRUE make test
#make test ARGS="-V"

  # When running tests we necessarily have to document the location of the
  # libraries that were built locally.
set(OdsStream_FOUND 1)
set(OdsStream_INCLUDE_DIRS "${CMAKE_SOURCE_DIR}/src")
set(OdsStream_LIBRARY "${CMAKE_BINARY_DIR}/src/libodsstream.so")
    add_library(OdsStream::Core UNKNOWN IMPORTED)
    set_target_properties(OdsStream::Core PROPERTIES
        IMPORTED_LOCATION             "${OdsStream_LIBRARY}"
        INTERFACE_INCLUDE_DIRECTORIES "${OdsStream_INCLUDE_DIRS}"
    )


  message("${OdsStream_INCLUDE_DIRS}")
  message("${OdsStream_LIBRARY}")

  configure_file(config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h)


find_package(Qt6 COMPONENTS Core Xml Gui REQUIRED)

find_package(Catch2 REQUIRED)

message(STATUS "For running the tests, use library: ${OdsStream_LIBRARY}")

add_executable(test_ods test_ods.cpp metadataodsreader.cpp)
target_link_libraries(test_ods
  ${OdsStream_LIBRARY}
  Catch2::Catch2
  Catch2::Catch2WithMain
  Qt6::Core
  Qt6::Gui
  QuaZip::QuaZip
  )
target_include_directories(test_ods PUBLIC
  ${OdsStream_INCLUDE_DIRS}
  ${CMAKE_CURRENT_BINARY_DIR}
)
add_test(test_ods "test_ods")


add_executable(test_tsv test_tsv.cpp )
target_link_libraries(test_tsv
  ${OdsStream_LIBRARY}
  Catch2::Catch2
  Catch2::Catch2WithMain
  Qt6::Core
  Qt6::Gui
  QuaZip::QuaZip
)
target_include_directories(test_tsv PUBLIC
  ${OdsStream_INCLUDE_DIRS}
  ${CMAKE_CURRENT_BINARY_DIR}
)
add_test(test_tsv "test_tsv")


add_executable(test_zlib test_zlib.cpp)
target_link_libraries(test_zlib
  ${OdsStream_LIBRARY}
  Catch2::Catch2
  Catch2::Catch2WithMain
  Qt6::Core
  QuaZip::QuaZip
)
target_include_directories(test_zlib PUBLIC
  ${OdsStream_INCLUDE_DIRS}
  ${CMAKE_CURRENT_BINARY_DIR}
)
add_test(test_zlib "test_zlib")
