Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CMake improvements when vendoring w/ FetchContent
This patch makes the following improvements to the CMake configuration: - If the target ZLIB::ZLIB already exists, find_package for zlib is not called: this is advantageous if the project that is vendoring libspng is also vendoring zlib, or has an alternate zlib implementation (like zlib-ng.) Otherwise, ugly hacks are needed to make the find_package a no-op (e.g.: introducing a FindZLIB.cmake module somewhere earlier in the search path that does this check and then calls the root module.) - It will now honor the `SKIP_INSTALL_ALL`, `SKIP_INSTALL_HEADERS`, and `SKIP_INSTALL_LIBRARIES` variables when setting up `install` targets. This is useful because zlib also honors this setting, and there's not much sense in installing libspng if it depends on vendored zlib which is not going to have install targets. (It causes an error, too.) This should be fairly safe: when configuring standalone, this shouldn't change any of the existing behavior. For vendoring with `FetchContent`, I reckon this still shouldn't break any of the existing cases. This can help on Windows for a project that aims to compile out-of-the-box using Visual Studio without needing tooling like vcpkg, as zlib isn't present by default in this environment. Fixes randy408#266.
- Loading branch information