Do not use find_dependency in matioCppConfig.cmake if OVERRIDE_MODULE_PATH is used #41
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Before this PR, the
matioCppConfig.cmake
file contained this lines:Unfortunately these lines do not work correctly if
MATIO
is not present in the system butmatioCpp
is present. In that case, thematioCppConfig.cmake
gets executed till to thefind_dependency(MATIO QUIET)
call, and then the rest of the script is not executed as,find_dependency
callsreturn()
if the package is not found (see https://github.com/Kitware/CMake/blob/v3.19.6/Modules/CMakeFindDependencyMacro.cmake#L59). The net effect is that ifMATIO
is not found, theCMAKE_MODULE_PATH
gets corrupted by any call tofind_package(matioCpp)
, even if it was justfind_package(matioCpp QUIET)
.This PR proposes to fix this problem by using
find_package
there instead offind_dependency
. The main downside is that the error if MATIO is not found will be less clear, but this is in any case better then silently corruping theCMAKE_MODULE_PATH
value.