pepe82sh / ConanCmakeToolchainGenerator

A generator for conan that can be used to build conan packages by invoking cmake instead of conan build
MIT License
3 stars 0 forks source link

Simple example #4

Open AltenOosterbeek opened 4 years ago

AltenOosterbeek commented 4 years ago

Hi Pepe,

I'm new to Conan and I was checking out your ConanCMakeToolchainGenerator. It looks like something I have been looking for. However, I am not able to set up a simple example. Using your source, I use the command "conan create . wo/testing. However, it fails in some way in the testing stage.

It would be very helpful to write down an example, instead of only the CMakeLists file you give now, with for example a project that includes one main file and one dependency. That would really help.

Kind regards.

Wouter Oosterbeek

AltenOosterbeek commented 4 years ago

Ok, apparently, this was due to my lack of knowledge. With the help of https://docs.conan.io/en/latest/howtos/custom_generators.html I figured it out. Maybe add that link and specifically mention to use "conan export ." (instead of conan create as I did...) and then in the conanfile.txt you can add the conan package "cmake_toolchain_generator/0.2@.../..." to [requires] and CmakeToolchain to [generators], only thing to do then is add "include( ${CMAKE_BINARY_DIR}/conan_toolchain.cmake )" to CMakeLists.txt (I'm not sure if it is necessary to place is before project?). I think if you add this information in the readme, things will be a lot easier for people.