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 bug of OVERRIDE_MODULE_PATH that corrupt CMAKE_MODULE_PATH values set by blf transitive dependencies #827

Merged
merged 2 commits into from
Apr 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions .github/workflows/conda-forge-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
liblie-group-controllers eigen qhull "casadi>=3.5.5" cppad spdlog \
nlohmann_json manif manifpy pybind11 numpy pytest scipy opencv pcl \
tomlplusplus libunicycle-footstep-planner "icub-models>=1.23.4" \
ros-humble-rclcpp onnxruntime-cpp libbayes-filters-lib
ros-humble-rclcpp onnxruntime-cpp libbayes-filters-lib cmake-package-check

- name: Linux-only Dependencies [Linux]
if: contains(matrix.os, 'ubuntu')
Expand Down Expand Up @@ -81,7 +81,7 @@ jobs:
run: |
mkdir -p build
cd build
cmake -GNinja -DBUILD_TESTING:BOOL=ON -DFRAMEWORK_COMPILE_IK:BOOL=OFF \
cmake -GNinja -DBUILD_TESTING:BOOL=ON -DFRAMEWORK_COMPILE_IK:BOOL=OFF -DCMAKE_INSTALL_PREFIX=$CONDA_PREFIX \
-DFRAMEWORK_COMPILE_PYTHON_BINDINGS:BOOL=ON -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} ..

- name: Build [Linux&macOS]
Expand All @@ -104,7 +104,7 @@ jobs:
run: |
mkdir -p build
cd build
cmake -GNinja -DBUILD_TESTING:BOOL=ON -DFRAMEWORK_COMPILE_PYTHON_BINDINGS:BOOL=ON -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} ..
cmake -GNinja -DBUILD_TESTING:BOOL=ON -DFRAMEWORK_COMPILE_PYTHON_BINDINGS:BOOL=ON -DCMAKE_INSTALL_PREFIX=%CONDA_PREFIX%\Library -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} ..

- name: Build [Windows]
if: contains(matrix.os, 'windows')
Expand All @@ -119,3 +119,10 @@ jobs:
run: |
cd build
ctest --output-on-failure -C ${{ matrix.build_type }}

- name: Install and test installed package
shell: bash -l {0}
run: |
cd build
cmake --install . --config ${{ matrix.build_type }}
cmake-package-check BipedalLocomotionFramework
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ All notable changes to this project are documented in this file.

### Fixed
- Fix the barrier logic for threads synchronization (https://github.com/ami-iit/bipedal-locomotion-framework/pull/811)
- InstallBasicPackageFiles: Fix bug of OVERRIDE_MODULE_PATH that corrupt CMAKE_MODULE_PATH values set by blf transitive dependencies (https://github.com/ami-iit/bipedal-locomotion-framework/pull/827)

### Removed

Expand Down
17 changes: 10 additions & 7 deletions cmake/InstallBasicPackageFiles.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@
# :command:`install` commands, otherwise <Name> is used.
#
# If the ``OVERRIDE_MODULE_PATH`` is set, the autogenerated ``<Name>Config.cmake``
# file temporarily overrides the ``CMAKE_MODULE_PATH`` with the specified paths.
# file temporarily prepends the ``CMAKE_MODULE_PATH`` with the specified paths.

#=============================================================================
# Copyright 2013 Istituto Italiano di Tecnologia (IIT)
Expand Down Expand Up @@ -576,13 +576,11 @@ ${_compatibility_vars}
endif()

unset(PACKAGE_DEPENDENCIES)
set(_overridden_module_path_list "")
if(DEFINED _IBPF_DEPENDENCIES)
set(PACKAGE_DEPENDENCIES "#### Expanded from @PACKAGE_DEPENDENCIES@ by install_basic_package_files() ####\n\ninclude(CMakeFindDependencyMacro)\n")

if (DEFINED _IBPF_OVERRIDE_MODULE_PATH)

string(APPEND PACKAGE_DEPENDENCIES "set(CMAKE_MODULE_PATH_BK_${_IBPF_VARS_PREFIX} \${CMAKE_MODULE_PATH})\n")
set(_overridden_module_path "")
foreach(_path ${_IBPF_OVERRIDE_MODULE_PATH})

if (IS_ABSOLUTE ${_path})
Expand All @@ -592,9 +590,12 @@ ${_compatibility_vars}
endif()

file(RELATIVE_PATH _relative_path ${CMAKE_INSTALL_PREFIX} ${_absolute_module_path})
string(APPEND _overridden_module_path " \${PACKAGE_PREFIX_DIR}/${_relative_path}")
string(APPEND _overridden_module_path_list ";\${PACKAGE_PREFIX_DIR}/${_relative_path}")
endforeach()
string(APPEND PACKAGE_DEPENDENCIES "set(CMAKE_MODULE_PATH${_overridden_module_path})\n")
string(APPEND PACKAGE_DEPENDENCIES "foreach(overridden_module_path ${_overridden_module_path_list})\n")
string(APPEND PACKAGE_DEPENDENCIES " list(PREPEND CMAKE_MODULE_PATH \${overridden_module_path})\n")
string(APPEND PACKAGE_DEPENDENCIES "endforeach()\n")

# If OVERRIDE_MODULE_PATH is used, then if a dependency is not found find_dependency will
# halt the execution of the <package>config.cmake script, never restoring the original
# value of CMAKE_MODULE_PATH. For this reason, in this case we just use find_package
Expand Down Expand Up @@ -654,7 +655,9 @@ endif()
endif()

if(DEFINED _IBPF_OVERRIDE_MODULE_PATH)
string(APPEND PACKAGE_DEPENDENCIES "set(CMAKE_MODULE_PATH \${CMAKE_MODULE_PATH_BK_${_IBPF_VARS_PREFIX}})\n")
string(APPEND PACKAGE_DEPENDENCIES "foreach(overridden_module_path ${_overridden_module_path_list})\n")
string(APPEND PACKAGE_DEPENDENCIES " list(REMOVE_ITEM CMAKE_MODULE_PATH \${overridden_module_path})\n")
string(APPEND PACKAGE_DEPENDENCIES "endforeach()\n")
endif()

set(PACKAGE_DEPENDENCIES "${PACKAGE_DEPENDENCIES}\n###############################################################################\n")
Expand Down
Loading