ami-iit / bipedal-locomotion-framework

Suite of libraries for achieving bipedal locomotion on humanoid robots
https://ami-iit.github.io/bipedal-locomotion-framework/
BSD 3-Clause "New" or "Revised" License
132 stars 36 forks source link

InstallBasicPackageFiles: Fix OVERRIDE_MODULE_PATH with CMake >=3.29.1 #835

Closed traversaro closed 3 months ago

traversaro commented 3 months ago

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 https://github.com/ami-iit/matio-cpp/issues/78#issuecomment-2044457554 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 https://github.com/ami-iit/matio-cpp/pull/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 https://github.com/ami-iit/cmake-package-check/pull/8 .

traversaro commented 3 months ago

Thanks for the changelog fix.