ArthurSonzogni / FTXUI

:computer: C++ Functional Terminal User Interface. :heart:
MIT License
6.64k stars 399 forks source link

Add example to use system ftxui #814

Closed jubalh closed 7 months ago

jubalh commented 7 months ago

https://arthursonzogni.github.io/FTXUI/#build-cmake mentions how to build using CMake by fetching the sources. Since ftxui is packaged for many distributions I think it would be good to also include an example of using the system ftxui package instead of git fetching it.

ArthurSonzogni commented 7 months ago

Good idea! Please let me know if the latest change addressed your issue.

jubalh commented 7 months ago

Thanks for the quick response!

Yes that looks good.

On my system I have a problem but I assume that is my fault somehow:

$ cat CMakeLists.txt 
cmake_minimum_required (VERSION 3.11)

cmake_minimum_required (VERSION 3.11)
find_package(ftxui 5 REQUIRED)
project(ftxui-starter LANGUAGES CXX VERSION 1.0.0)
add_executable(ftxui-starter src/main.cpp)
target_link_libraries(ftxui-starter
  PRIVATE ftxui::screen
  PRIVATE ftxui::dom
  PRIVATE ftxui::component # Not needed for this example.
)

$ mkdir build; cd build
$ cmake ..
CMake Error at CMakeLists.txt:4 (find_package):
  By not providing "Findftxui.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "ftxui", but
  CMake did not find one.

  Could not find a package configuration file provided by "ftxui" (requested
  version 5) with any of the following names:

    ftxuiConfig.cmake
    ftxui-config.cmake

  Add the installation prefix of "ftxui" to CMAKE_PREFIX_PATH or set
  "ftxui_DIR" to a directory containing one of the above files.  If "ftxui"
  provides a separate development package or SDK, be sure it has been
  installed.

-- Configuring incomplete, errors occurred!
$ rpm -ql ftxui-devel|grep .cmake
/usr/lib64/cmake/ftxui
/usr/lib64/cmake/ftxui/ftxui-config-version.cmake
/usr/lib64/cmake/ftxui/ftxui-config.cmake
/usr/lib64/cmake/ftxui/ftxui-targets-relwithdebinfo.cmake
/usr/lib64/cmake/ftxui/ftxui-targets.cmake

As a test I did export CMAKE_MODULE_PATH=/usr/lib64/cmake/ftxui but still get the same. In case you have an idea that would be great. But I consider this issue still as solved since the rest seems to be a problem on my side.

jubalh commented 6 months ago

@ArthurSonzogni do you have by chance any idea?