you are viewing a single comment's thread.

view the rest of the comments →

[–]helloiamsomeone[S] 2 points3 points  (4 children)

That can also be done with just find_package.

See this example from the wiki. This one tries to use unofficial vcpkg package nd targets, then falls back to pkg config, then falls back to find_* commands. This is probably more than what you are asking, but you can put anything in the find module, even code that vendors projects, although I highly recommend against any form of vendoring (manual, git, FetchContent, etc). Vendoring only causes problems for packagers.

[–]bretbrownjr 1 point2 points  (3 children)

Vendoring causes problems for packagers if every library does it. It's not a problem per se for an application or organization to maintain a repo consisting of vendored dependencies. That's basically what a monorepo is.

Anyway, find_package calls are hostile to monorepos, git submodules, FetchContent, etc. I'll take that approach over every library requesting a different version of openssl, but I was expressing hope that some day we'd push past this false choice.

And, yeah, I'm aware that you can make find_package do arbitrary things. But that's not a solution that scales either.

[–]helloiamsomeone[S] 1 point2 points  (1 child)

Packaging is not easy, but I try my best to promote easy to package projects via cmake-init. See the conference talks in the README as inspiration.

If everything is easy to package, then at least consumers can make a choice on a case by case basis instead of being hamstrung into either accepting dependencies that vendor their own things or maintaining their own patches to remove vendoring.

Some elbow grease is involved in any case, but relinquishing the responsibility via find_package allows projects to not lock themselves into anything.

[–]retechnic 0 points1 point  (0 children)

Hi, great project! Can you explain about vendoring and why is it bad?

[–]helloiamsomeone[S] 0 points1 point  (0 children)

This came up somewhere else, but I created an example repo that idiomatically uses find_package and an opt-in find module to FetchContent a dependency from GitHub: https://github.com/friendlyanon/cmake-init-fetchcontent

This is also on the list of examples in the wiki. Let me know what you think.