4 ms·
The author of the article will realize their mistake when they try to consume a library that consumes its own dependencies via the same FetchContent mechanism,
by hamstergene 5y ago
The author of the article will realize their mistake when they try to consume a library that consumes its own dependencies via the same FetchContent mechanism, and one of those dependencies will be the same as what author’s executable needs. Or when they need to compile a build tool (like protobuf compiler) that needs to target build host rather than what CMake currently targets.
All such ad-hoc solutions are not scalable, and as the project grows the moment will come when you’ll have to throw all of that away and do everything differently. Dependency management is a lot harder problem than just downloading and unpacking a zip. Why not leave the job to specialized tools from the start?
The argument against package managers is poor. At least with Conan, your project's CMake list does not have to depend on the package manager; instead one can consume dependencies from Conan and use `cmake_paths` generator and `find_library()` to link to them, allowing consumers of your project to use something other than Conan.
EDIT: Also, many open-source projects are not based on CMake themselves but have very weird very custom build scripts e.g. OpenSSL, FFmpeg, that can easily kill several days of your time each just to get going. All while package managers' recipes already have all of that figured out, just provide `feature1=yes feature2=no ...` and they will handle the rest.
- gabereiser 5y agoThis. For some of my native projects I’ve resorted to building a “fat lib” or amalgamated build of all dependencies into a static library. It’s a pattern I first saw when dealing with gameplay3d. It works for me. I then include the fat lib as a dependency to my library and let the compiler prune my lib of unused while leaving the static dependency lib unchanged. CMake on the surface looks good, is easy to work with, but once you start having dependencies of dependencies (some of which you need too) you run into issues that you have to script your way out of. I’ve tried vpkg as well and it has the same kind of issues. What does the future hold for native development when so much of your initial time is spent fighting the tools?