如何将外部依赖引入跨平台CMake项目?

How to bring external dependencies into cross-platform CMake project?

将外部依赖项引入跨平台 CMake 项目的最佳方法是什么?请参阅下面我看到的问题范围和解决方案。

问题范围

假设我们有一个具有以下约束的 C/C++ 项目:

很高兴有东西:

可能的解决方案

参考资料

您的 PoC 可能有效,但 CMake 内置了 solution for fetching external projects during the configure step. If this does not satisfy your requirements like non CMake based dependencies, you may have a look at Conan

https://blog.conan.io/2018/06/11/Transparent-CMake-Integration.html