cmake_minimum_required(VERSION 3.22)
project(lsqy_artifact_consumer VERSION 1.0.0 LANGUAGES CXX)

include(CTest)
include(GNUInstallDirs)

find_package(Eigen3 CONFIG REQUIRED)
find_package(fmt CONFIG REQUIRED)
find_package(spdlog CONFIG REQUIRED)
find_package(nlohmann_json CONFIG REQUIRED)
find_package(yaml-cpp CONFIG REQUIRED)
find_package(tinyxml2 CONFIG REQUIRED)
find_package(GTest CONFIG REQUIRED)
find_package(libxml2 CONFIG REQUIRED)

add_executable(artifact-smoke main.cpp)
target_compile_features(artifact-smoke PRIVATE cxx_std_17)
set_target_properties(artifact-smoke PROPERTIES CXX_EXTENSIONS OFF)
target_link_libraries(artifact-smoke PRIVATE
    Eigen3::Eigen
    fmt::fmt
    spdlog::spdlog
    nlohmann_json::nlohmann_json
    yaml-cpp::yaml-cpp
    tinyxml2::tinyxml2
    GTest::gtest
    LibXml2::LibXml2
)

if(BUILD_TESTING)
    add_test(NAME artifact-smoke COMMAND artifact-smoke)
endif()

install(TARGETS artifact-smoke RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
install(FILES LICENSE DESTINATION ${CMAKE_INSTALL_DATADIR}/lsqy-artifact-consumer)
