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

Use PROJECT_SOURCE_DIR instead of CMAKE_SOURCE_DIR to allow for better submodulization #953

Merged
merged 1 commit into from
Aug 9, 2023

Conversation

apozharski
Copy link
Contributor

When using cmake add_subdirectory if using acados as a submodule, the use of CMAKE_SOURCE_DIR adds the wrong directories. Using PROJECT_SOURCE_DIR instead produces the same results when building acados on its own but also adds the correct directories when included in other CMAKE projects.

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!

@FreyJo FreyJo changed the title Use PROJECT_SOURCE_DIR to allow for better submodulization Use PROJECT_SOURCE_DIR instead of CMAKE_SOURCE_DIR to allow for better submodulization Aug 9, 2023
@FreyJo FreyJo merged commit 2a6e2bf into acados:master Aug 9, 2023
3 checks passed
@imciner2
Copy link

I don't think the PROJECT_SOURCE_DIR would work if the upper CMake has a project() call in it though, then it would just add the root project directory instead of the acados directory, see the docs https://cmake.org/cmake/help/latest/variable/PROJECT_SOURCE_DIR.html that say

This is the source directory of the last call to the project() command made in the current directory scope or one of its parents. Note, it is not affected by calls to project() made within a child directory scope (i.e. from within a call to add_subdirectory() from the current scope).

Instead, it should be ${CMAKE_CURRENT_SOURCE_DIR}/../ in the path to add these acados folders.

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#953. Said ad-hoc path
adjustment is likely made unnecessary by acados#1065, which introduced
installing cmake scripts to standard locations.
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

3 participants