find_package(tomlplusplus)
if(NOT tomlplusplus_FOUND)
    find_dependency(PkgConfig)
    pkg_check_modules(tomlplusplus REQUIRED IMPORTED_TARGET tomlplusplus)
endif()

FILE(GLOB SRCS *.cpp)

add_library(trexe-lib STATIC ${SRCS})
target_precompile_headers(trexe-lib REUSE_FROM common)
target_link_libraries( trexe-lib common ${CMAKE_DL_LIBS})
target_include_directories(trexe-lib PUBLIC ".")

add_executable(trexe bin/trexe.m.cpp)
target_precompile_headers(trexe REUSE_FROM common)
target_link_libraries(trexe trexe-lib common)
target_include_directories(trexe PRIVATE ".")

install(TARGETS trexe RUNTIME DESTINATION bin)

include(CTest)
if(BUILD_TESTING)
    add_subdirectory(test)
endif()
