![]() If the interception of ``find_package()`` for a specific version calls a package manager, and brings that package and some transitive needed dependency, lets say ``zlib/1.2.8``, and then a posterior ``find_package()`` for another package and another specific version transitively depends on ``zlib/1.2.12``, then you have a version conflict that has been skipped silently and will easily bite later, hopefully at build/link time, but many times can produce complicated to debug runtime errors. This approach has one disadvantage, it cannot handle dependencies conflicts, so it only works assuming a flat dependency graph, that is, without versions, or with all versions matching perfectly. That's the pros for me and it just solves all the problems I was having so hence, game changer for me :) Then if it's not on Conan I can just fork the project and add a cmake wrapper for the worst case scenario. I still use Conan for any popular libraries that aren't cmake as Conan let's you consume a dependency built by build system X while you are on build system Y. Of course there is one drawback, this only works with CMake dependencies, but easily solvable. ![]() that custom setup could also be development stages, so I could be developing two packages together, and temporarily just change the fetch content to point to a location on my machine where I'm developing that package!. ![]() because I'm using find package I can disable fetch content if I want to use a custom setup I might have, like system install or whatever.of course for companies you can then point to your own private repos and not have to spin up any servers.I can now point my project to depend on some random GitHub library I wrote, or someone else that's not on Conan servers.The magic of 3.24 is FetchContent_Declare with the argument OVERRIDE_FIND_PACKAGE, which will tell find package to look wherever fetch content is pointing for the dependency. I will then have options to enable/disable where my project expects the dependencies so the consumer project can change them which is very important. I will then have a top level cmake (or maybe a sub folder config/ if you want to organize) which defines where all the dependencies come from. I have a CMakeLists.txt in my src/ folder which does all the add libraries/executables for my project and find_packages, so when creating the dependencies they are asking for package X but not caring where or how it comes from. I just want to say "hey CMake, I wrote the dependency X its in this repo on GitHub", but without requiring that usage every time. As most package managers (I believe) want to pull dependencies from a server, and I don't want to push my code to another server. ![]() The big problem I couldn't solve with Conan (my package manager), was trying to reuse my own libraries on GitHub. I've been playing with this lately, it's a game changer ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |