InstallBasicPackageFiles: Fix OVERRIDE_MODULE_PATH with CMake >=3.29.1 #835
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.
OVERRIDE_MODULE_PATH
used thePACKAGE_PREFIX_DIR
variable, that however was an internal undocumented detail of configure_package_config_file and that was changed in CMake 3.29.1 by https://gitlab.kitware.com/cmake/cmake/-/merge_requests/9390 .See ami-iit/matio-cpp#78 (comment) for more context.
To fix the problem, we switch to add directly the
OVERRIDE_MODULE_PATH
logic in the generated cmake config template, so that there we can use the@PACKAGE_CMAKE_INSTALL_PREFIX@
variable, and rely on theconfigure_package_config_file
to appropriately substitute@PACKAGE_CMAKE_INSTALL_PREFIX@
with the actual relocated install prefix. To do so, we also passCMAKE_INSTALL_PREFIX
to thePATH_VARS
option ofconfigure_package_config_file
.See also ami-iit/matio-cpp#79 . I also added a test to prevent regression related to this in CI, in the form of
cmake-package-check BipedalLocomotionFramework --targets BipedalLocomotion::Framework
thanks to ami-iit/cmake-package-check#8 .