Skip to content

Bazel/CMake: auto detect all cc_binary/cc_test targets #15536

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

Merged
merged 4 commits into from
Feb 29, 2024

Conversation

redsun82
Copy link
Contributor

@redsun82 redsun82 commented Feb 7, 2024

This works by letting cmake generate a BUILD.bazel file with a generate_cmake bazel target using the result of a bazel query.

bazel aquery is used so that only targets compatible with the detected platform are listed. This requires some JSON parsing though.

@redsun82 redsun82 requested review from a team as code owners February 7, 2024 10:14
@github-actions github-actions bot added the Swift label Feb 7, 2024
@redsun82 redsun82 requested review from criemen and AlexDenisov and removed request for criemen February 7, 2024 10:14
It turns out `bazel aquery` is not so well behaved on Windows, so we
need to accept that it reports errors and exits with an error.
@redsun82 redsun82 removed the request for review from AlexDenisov February 29, 2024 13:27
Copy link
Contributor

@sashabu sashabu left a comment

Choose a reason for hiding this comment

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

Works for me in Visual Studio. Thanks!

@redsun82 redsun82 merged commit 6d90877 into main Feb 29, 2024
@redsun82 redsun82 deleted the redsun82/bazel-cmake branch February 29, 2024 17:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants