Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

InstallBasicPackageFiles: Fix OVERRIDE_MODULE_PATH with CMake >=3.29.1 #835

Merged
merged 2 commits into from
Apr 9, 2024

Conversation

traversaro
Copy link
Collaborator

@traversaro traversaro commented Apr 9, 2024

OVERRIDE_MODULE_PATH used the PACKAGE_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 the configure_package_config_file to appropriately substitute @PACKAGE_CMAKE_INSTALL_PREFIX@ with the actual relocated install prefix. To do so, we also pass CMAKE_INSTALL_PREFIX to the PATH_VARS option of configure_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 .

OVERRIDE_MODULE_PATH used the PACKAGE_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 the configure_package_config_file to appropriately substitute @PACKAGE_CMAKE_INSTALL_PREFIX@
with the actual relocated install prefix. To do so, we also pass CMAKE_INSTALL_PREFIX to the
PATH_VARS option of configure_package_config_file.
@GiulioRomualdi GiulioRomualdi enabled auto-merge (squash) April 9, 2024 10:26
@traversaro
Copy link
Collaborator Author

Thanks for the changelog fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants