-
Notifications
You must be signed in to change notification settings - Fork 123
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
Workaround to exclude Clion's cmake folders from colcon build and tests #410
Workaround to exclude Clion's cmake folders from colcon build and tests #410
Conversation
- Add AMENT_IGNORE to CMAKE_BINARY_DIR to avoid picking up cmake specific folders created by CLion in `colcon build` and `colcon test` commands Signed-off-by: Michael Orlov <michael.orlov@apex.ai>
@wjwwood @clalancette Please review. |
I'm curious why this is necessary as colcon already creates |
@mjcarroll Yes. CLion creating it's own folders for build. |
This is confusing to me, can you describe your workflow better? Are you using CLion only or colcon only or both? |
@wjwwood My workflow is that I use both CLion build for particular package running above build from colcon to be able to use debugger and run unit tests from CLion. As well as using colcon build and colcon test commands separately. The problem is as soon as I start CLion and load some CMake file from any The problems starts when I try to call regular Proposed workaround will automatically put I have been using this fix for a couple years for development for ROS2 and we are using it in ApexAI internally for more then 3 years. It should be pretty much safe and I don't envision any side effects. |
I can't think of anything that will break with this workaround. Maybe it would break someone wanting to do in-source builds, but I wouldn't expect those to be supported by Colcon anyways.
Maybe there's a setting that will make CLion do that work out-of-source? https://intellij-support.jetbrains.com/hc/en-us/community/posts/360007742199-How-to-set-a-default-build-directory-OUTSIDE-the-source-directory- |
@sloretz As regards to the
Could you please clarify how it could break and what exactly? As regards to the
This is more question in jetbrain support system rather then answer on the problem and pretty much outdated. There are no such options |
Another workaround: you can add a "." prefix to the various cmake-build-* directories to hide them from colcon. |
@clydemcqueen Unfortunately not. We can't add "." prefix to the various cmake-build-* directories since those folder names manged by the CLion directly and not available for users to be changed. The purpose of this PR is to provide seamless integration of the |
I'm not a maintainer on this repository, so I'll leave it to @mjeronimo and/or previous maintainers (maybe @hidmic has an opinion). For what it's worth I think that this patch is unlikely to cause a problem and we should probably merge it. But also, I do not think this is the right fix from |
I'm also not a maintainer, but given this is an issue with the combination of colcon and CLion I'd recommend solving it by creating a |
I think that the proposed change is a reasonable workaround. Adding a COLCON_IGNORE to the CMAKE_BINARY_DIR seems fairly straightforward since colcon shouldn't be building anything there anyways. Also, having the IGNORE file there is also clear about the intention (versus having a plugin filter it out, which could be harder to debug if there was a problem). Seems OK to me. |
I would recommend |
Yes, agreed. AMENT_IGNORE |
Thank you folks for accepting and merging this PR. |
Hi, I think that this PR broke ament-clang-tidy. This PR added the |
@alsora It looks like the check for the AMENT_IGNORE files is redundant and a bit outdated in ament-clang-tidy
https://github.com/ament/ament_lint/blob/f10eecd28cdc05746c1f8c0f45984db6052cfd40/ament_clang_tidy/ament_clang_tidy/main.py#L280-L282 |
I agree. Most linters look at the source folder, but clang-tidy looks at the build folder to find the compilation database. I think it's safe to remove the check in clang-tidy. |
colcon build
andcolcon test
commandsSigned-off-by: Michael Orlov michael.orlov@apex.ai