cpp-best-practices / gui_starter_template

A template CMake project to get you started with C++ and tooling
The Unlicense
2.51k stars 445 forks source link

[Question] Is the conanfile.txt kept intentionally? #188

Closed LtdSauce closed 2 years ago

LtdSauce commented 2 years ago

Hi,

i recently found out, that conan-cmake can generate the conanfile during configuration. Is the conanfile.txt kept intentionally inside the repo or could the generation be automated?

To make that possible the Conan.cmake module from project_options have to change a little bit. I got it working applying by adding the following before the foor-loop inside the Conan.cmake:

conan_cmake_configure(
  REQUIRES   
    catch2/2.13.7
    docopt.cpp/0.6.2
    fmt/8.0.1
    spdlog/1.9.2
  GENERATORS 
    cmake_find_package_multi
                      )

also changing the PATH_OR_REFERENCE of the conan_cmake_autodetect to ${CMAKE_BINARY_DIR}

I think this would be nice to have as it comes with an advantage:

Currently to enable ImGUI for example i have to change the conanfile and uncomment the section in the CMake-files. This could easily be messed up in the first place. If a new Variable like CONAN_DEPENDENCIES is added and the parts that have to be uncommented (or their correspondant CMakeLists.txt) would automatically add the dependency to the variable that would be nice. One downside of this approach is maybe, that not all conan dependencies are located at one spot.

What do you think?

lefticus commented 2 years ago

Yes, we intentionally moved from what you are suggesting into an external conanfile.txt some time ago.

LtdSauce commented 2 years ago

Ah, i see. Thanks for the explanation!

My question is answered. I'll close the issue then.