This prevents redundant calls to find_package and allows for projects including this as a subdirectory to define their own parameters for finding the dependency if CMake's find_package functionality is not adequate for the situation.
This applies to both required and optional packages due to CMake find_package not having the most graceful way of including non-system installed dependencies that are included as source in the parent project (such as a git submodule, or via FetchContent in CMake).
A more in-depth fix might also involve the custom .cmake package modules generated by zproject to do more checking on existing CMake package variables and not overridethem if they are already set, but that would ultimately yield the same functional result as this patch.
This prevents redundant calls to
find_package
and allows for projects including this as a subdirectory to define their own parameters for finding the dependency if CMake'sfind_package
functionality is not adequate for the situation.This applies to both required and optional packages due to CMake
find_package
not having the most graceful way of including non-system installed dependencies that are included as source in the parent project (such as a git submodule, or viaFetchContent
in CMake).A more in-depth fix might also involve the custom
.cmake
package modules generated byzproject
to do more checking on existing CMake package variables and not overridethem if they are already set, but that would ultimately yield the same functional result as this patch.