cmake_minimum_required(VERSION "4.2.0") project("ttwhy" VERSION "1.0.0" LANGUAGES CXX ) ### Fetch Dependencies include("FetchContent") FetchContent_Declare("asio" GIT_REPOSITORY "https://github.com/chriskohlhoff/asio" GIT_TAG "asio-1-38-0" ) FetchContent_Declare("catch2" GIT_REPOSITORY "https://github.com/catchorg/Catch2.git" GIT_TAG "v3.15.1" ) FetchContent_Declare("sml" GIT_REPOSITORY "https://github.com/boost-ext/sml" GIT_TAG "v1.2.0" ) FetchContent_MakeAvailable( "asio" "catch2" "sml" ) ### asio find_package("Threads") add_library("asio" INTERFACE) add_library("ext::asio" ALIAS "asio") target_include_directories("asio" SYSTEM INTERFACE "${asio_SOURCE_DIR}/asio/include" ) target_link_libraries("asio" INTERFACE "Threads::Threads" ) ### Core Library add_library("ttwhy-core") add_library("ttwhy::lib" ALIAS "ttwhy-core") target_sources("ttwhy-core" PUBLIC FILE_SET CXX_MODULES FILES "ttwhy/io.cppm" "ttwhy/lib.cppm" "ttwhy/scoped_attributes.cppm" "ttwhy/routers/echo.cppm" "ttwhy/routers/mod.cppm" "ttwhy/scanners/concepts.cppm" "ttwhy/scanners/events.cppm" "ttwhy/scanners/mod.cppm" "ttwhy/scanners/terminal_policies.cppm" "ttwhy/scanners/terminal_scanner.cppm" ) target_include_directories("ttwhy-core" PUBLIC "${CMAKE_SOURCE_DIR}" ) target_compile_features("ttwhy-core" PUBLIC "cxx_std_23" ) target_link_libraries("ttwhy-core" PUBLIC "ext::asio" "sml::sml" ) target_compile_options("ttwhy-core" PUBLIC "$<$:-Wall>" "$<$:-Wextra>" "$<$:-Werror>" "$<$:-pedantic-errors>" ) ### Main Executable add_executable("ttwhy") add_executable("ttwhy::app" ALIAS "ttwhy") target_sources("ttwhy" PRIVATE "ttwhy/main.cpp" ) target_link_libraries("ttwhy" PRIVATE "ttwhy::lib" ) ### Tests include("CTest") if(BUILD_TESTING) include("Catch") add_executable("ttwhy-tests") add_executable("ttwhy::tests" ALIAS "ttwhy-tests") target_sources("ttwhy-tests" PRIVATE "ttwhy/scanners/terminal_scanner.tests.cpp" ) target_link_libraries("ttwhy-tests" PRIVATE "ttwhy::lib" "Catch2::Catch2WithMain" ) catch_discover_tests("ttwhy-tests") endif()