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

Fix dependency handling in CMake config file #971

Merged
merged 1 commit into from
Oct 5, 2023

Conversation

Hs293Go
Copy link
Contributor

@Hs293Go Hs293Go commented Sep 29, 2023

This PR addresses 3 issues when consuming acados as a CMake dependency from a downstream project.

  1. Currently find_package(acados) breaks all following find_package calls since acadosConfig.cmake adjusts the CMAKE_MODULE_PATH. This should be restored to the original state per this cmake dev in the manner shown here.
  2. add_library(gfortran) and add_library(openblas) triggers target with the same name already exists errors if the acados config file is processed twice, so they should be guarded against double add_library by if guards
  3. If acados is build with ACADOS_WITH_OPENMP, the dependency on OpenMP is not handled in the config file

* Unset cmake module path at exit to avoid interfering with the caller's
  subsequent find_package calls

* Add if (NOT TARGET guards around add_library to avoid creating duplicate targets

* Finds OpenMP if acados is built with it
Copy link
Member

@FreyJo FreyJo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense!
Thanks a lot for the PR 👍

@FreyJo FreyJo merged commit d3fe230 into acados:master Oct 5, 2023
3 checks passed
Hs293Go added a commit to Hs293Go/acados that referenced this pull request Apr 24, 2024
Adjusting CMAKE_PREFIX_PATH in acadosConfig.cmake breaks dependency
handling by catkin when building a ROS package that depends on acados. A
similar path adjustment issue had been fixed by acados#971. Said ad-hoc path
adjustment is likely made unnecessary by acados#1065, which introduced
installing cmake scripts to standard locations.
Hs293Go added a commit to Hs293Go/acados that referenced this pull request Apr 24, 2024
Adjusting CMAKE_PREFIX_PATH in acadosConfig.cmake breaks dependency
handling by catkin when building a ROS package that depends on acados. A
similar path adjustment issue had been fixed by acados#971.
FreyJo pushed a commit that referenced this pull request Apr 24, 2024
Adjusting CMAKE_PREFIX_PATH in acadosConfig.cmake breaks dependency
handling by catkin when building a ROS package that depends on acados.

## Details

ROS's buildtool `catkin` controls `CMAKE_PREFIX_PATH` in the environment
to [handle
"workspaces"](https://catkin-tools.readthedocs.io/en/latest/verbs/catkin_config.html#explicitly-specifying-workspace-chaining),
which collides with `acadosConfig.cmake`'s own path adjustments.

Instead of replicating #971's means of reverting path adjustment at
exit, I simply deleted the path adjustment command as it seems to serve
no purpose. The associated comment suggests an absurd thing - no
`*Config.cmake` files could exist in the parent of the `cmake` folder,
which could either be root `acados` in case of default install or
`/usr/local` in case of global install
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants