I was setting up a project with CMake 3.21 (with
CMakePresets.json) with one preset that uses system packages and one that uses the vcpkg toolchain (if installed) to make development easy to get in (specifically for Windows).
When installing dependencies (currently only SDL2) I ran into the problem that
install(IMPORTED_RUNTIME_ARTIFACTS SDL2::SDL2 ...) on linux using the vcpkg preset errors due to it being an alias, because if SDL2 is build statically (vcpkg default on linux) it aliases
SDL2::SDL2 (even if it wouldn’t be an alias I expect it to error since it’s a static library).
- Windows + Native install: CMake configuration error since it can’t find SDL2 (expected)
- Windows + vcpkg install: Everything works fine and installs dependencies (expected)
- Linux + Native install: Everything works fine and installs dependencies (expected)
- Linux + vcpkg install: CMake configuration error because
SDL2::SDL2is an alias (unsure what to do about this?)
Now I was wondering if there is any specific way I could get this to install the dependencies only when they are built dynamically?