Pointing to a Library Across Platforms

时间:2019-04-17 02:45:40

标签: c++ cmake

When working on a CMake project, I typically either use pkg-config to locate libraries, or download dependencies to a specific location on my system and hardcode these paths. This works well when using one machine, but makes things a hassle when switching between multiple machines, or even interchangeably developing on Linux and Windows.

It seems like a poor solution to simply expect libraries to be in a specific, hardcoded location (i.e. C:\VulkanSDK\Some-Specific-Version-Number and C:\GLFW\, as I have on windows) which varies depending on the host system, as this adds additional setup steps whenever someone clones a project to develop on a different machine. It also seems like a bad idea to explicitly include library sources and builds within my repository, or to use git submodules (since some libraries don't host builds with git.)

What's the best way to manage library dependencies like this cross-platform?

0 个答案:

没有答案