diff --git a/CMakeLists.txt b/CMakeLists.txt index ec44738e..2fbe694d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -180,9 +180,15 @@ include(cmake/ftxui_package.cmake) add_subdirectory(examples) add_subdirectory(doc) -if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.28) - message(STATUS "Building C++ modules (CMake ${CMAKE_VERSION} supports modules)") - add_subdirectory(modules/ftxui) +option(FTXUI_BUILD_MODULES "Build C++ modules support" OFF) + +if(FTXUI_BUILD_MODULES) + if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.28) + message(STATUS "Building C++ modules (CMake ${CMAKE_VERSION} supports modules)") + add_subdirectory(modules/ftxui) + else() + message(STATUS "Skipping C++ modules (requires CMake 3.28+, found ${CMAKE_VERSION})") + endif() else() - message(STATUS "Skipping C++ modules (requires CMake 3.28+, found ${CMAKE_VERSION})") -endif() + message(STATUS "C++ modules support is disabled. Enable with -DFTXUI_BUILD_MODULES=ON") +endif() \ No newline at end of file diff --git a/README.md b/README.md index 96e26fcb..10a478b4 100644 --- a/README.md +++ b/README.md @@ -40,6 +40,7 @@ A simple cross-platform C++ library for terminal based user interfaces! * Support for animations. [Demo 1](https://arthursonzogni.github.io/FTXUI/examples/?file=component/menu_underline_animated_gallery), [Demo 2](https://arthursonzogni.github.io/FTXUI/examples/?file=component/button_style) * Support for drawing. [Demo](https://arthursonzogni.github.io/FTXUI/examples/?file=component/canvas_animated) * No dependencies + * Module support * **Cross platform**: Linux/MacOS (main target), WebAssembly, Windows (Thanks to contributors!). * Learn by [examples](#documentation), and [tutorials](#documentation) * Multiple packages: CMake [FetchContent]([https://bewagner.net/programming/2020/05/02/cmake-fetchcontent/](https://cmake.org/cmake/help/latest/module/FetchContent.html)) (preferred), vcpkg, pkgbuild, conan. @@ -396,6 +397,7 @@ If you choose to build and link FTXUI yourself, `ftxui-component` must be first g++ . . . -lftxui-component -lftxui-dom -lftxui-screen . . . ``` +To build FTXUI with modules, ensure that you are using a generator like Ninja or Visual Studio that supports modules, and pass the flag `FTXUI_BUILD_MODULES`. ## Contributors