adrianoviana87 / ltuiny

Text based utility that helps you add a transaction to a ledger file.
https://github.com/adrianoviana87/ltuiny
MIT License
12 stars 2 forks source link

Use CMake FetchContent? #2

Closed ArthurSonzogni closed 4 years ago

ArthurSonzogni commented 4 years ago

Hi adrianoviana87.

That's a really nice repository! I love the UI you made! I will add a link to your repository into the FTXUI one.


I notice you wrote in your README:

FTXUI -- I have to include this dependency as a submodule or something like that. For now, you can download the FTXUI repository and install the library.

If you don't want to require users of your library to download your dependencies themselves, I would like to let you know you could use CMake FetchContent.

CMake will download the repository for you at build time.

I have made an example with FTXUI: https://github.com/ArthurSonzogni/ftxui-starter/blob/master/CMakeLists.txt

You would just need to include this fragment of code:

include(FetchContent)

set(FETCHCONTENT_UPDATES_DISCONNECTED TRUE)
FetchContent_Declare(ftxui
  GIT_REPOSITORY https://github.com/ArthurSonzogni/ftxui
  # Specify a GIT TAG here.
)

FetchContent_GetProperties(ftxui)
if(NOT ftxui_POPULATED)
  FetchContent_Populate(ftxui)
  add_subdirectory(${ftxui_SOURCE_DIR} ${ftxui_BINARY_DIR} EXCLUDE_FROM_ALL)
endif()

The only drawbacks is that it requires cmake 3.11

adrianoviana87 commented 4 years ago

@ArthurSonzogni thank you. Your library is amazing! I'm glad you like it. I'll use your example since it's a good thing not to have to install your library separately in order to build the app.