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

Improve CMakeLists config path by using CMAKE_CURRENT_BINARY_DIR #319

Merged

Conversation

EwingKang
Copy link

Change CMAKE_BINARY_DIR to CMAKE_CURRENT_BINARY_DIR during configuration. This is useful when the project is a subdirectory/ submodule another project (e.g. apriltags_ros).

* Change CMAKE_BINARY_DIR -> CMAKE_CURRENT_BINARY_DIR so when the project is a subdirectory of some other project (e.g. apriltags_ros), it can be configured properly
@christian-rauch
Copy link
Collaborator

Specifically for ROS packages, you should rely on the binary packages or build the library as part of your workspace. But this seems useful nevertheless for projects that do not rely on colcon etc.

@christian-rauch christian-rauch merged commit e6cd3c7 into AprilRobotics:master Mar 5, 2024
19 checks passed
@EwingKang
Copy link
Author

@christian-rauch Thanks for the merge.
I'm sorry that I'm not sure what do you mean by "as part of your workspace".
I encountered the problem when building apriltags_ros project. The apriltags_ros's CMake include this project as a cmake subdirectory. It looks something like this:

apriltags_ros
├── apriltag_ros           # the project that needs apriltag
│   ├── CMakeLists.txt
├── apriltag                  # this project
│   ├── CMakeLists.txt

So when building using colcon it tries to search the files from apriltags_ros_build/ instead of apriltags_ros_build/apriltag/ (this is only an illustration, not the actual path). So that is the motive of changing the prefixes. Since it only uses CMake commands, that led me to believe that it is not related to ROS. Maybe I'm not understanding this correctly, I'll be happy to answer any further questions. Thanks again for the review.

@christian-rauch
Copy link
Collaborator

In this particular case, apriltag_ros manually checks out the library in its own source tree. But the correct way to depend on a ROS / colcon package is to specify the dependency in the package.xml and use the ROS ecosystem to resolve dependencies in the same way as all other dependencies (rclcpp, cv_bridge, image_transport, ...) are resolved.

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.

2 participants