Do not use find_dependency in matioCppConfig.cmake if OVERRIDE_MODULE_PATH is used#41
Conversation
|
Background: I hit this problem because I was debugging a failure in building the conda binary package for bipedal-locomotion-framework in https://github.com/traversaro/robotology-superbuild/runs/1998698606?check_suite_focus=true , as I was getting the error: The actual root cause was that installing the matio-cpp conda package was not installing also the libmatio conda package (this should be solved by conda-forge/libmatio-feedstock#34), but the fact that if matio was not found the |
|
macOS/Homebrew failures are unrelated, see https://github.com/traversaro/github-actions-brew-update-upgrade-check/actions/runs/608289319 . macOS/conda by the way works fine instead. |
S-Dafarra
left a comment
There was a problem hiding this comment.
Ah dammit, thanks for noticing.
Fixed InstallBasicPackageFiles to avoid the same problem of gbionics/matio-cpp#41
Before this PR, the
matioCppConfig.cmakefile contained this lines:Unfortunately these lines do not work correctly if
MATIOis not present in the system butmatioCppis present. In that case, thematioCppConfig.cmakegets executed till to thefind_dependency(MATIO QUIET)call, and then the rest of the script is not executed as,find_dependencycallsreturn()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 ifMATIOis not found, theCMAKE_MODULE_PATHgets 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_packagethere 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_PATHvalue.