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

[feature] Specify targets in CMake.build() #14878

Closed
1 task done
Ahajha opened this issue Oct 5, 2023 · 4 comments · Fixed by #14883
Closed
1 task done

[feature] Specify targets in CMake.build() #14878

Ahajha opened this issue Oct 5, 2023 · 4 comments · Fixed by #14883

Comments

@Ahajha
Copy link

Ahajha commented Oct 5, 2023

What is your suggestion?

My org has been moving away from using EXCLUDE_FROM_ALL for test targets, as it generally makes building + testing easier, but this means we need to specify which targets to build in the package.

Currently, we do the following:

cmake.build(cli_args=["--target", "my_library"])

As a minor QOL, it would be nice if we could say something like

cmake.build(targets=["my_library"])

Have you read the CONTRIBUTING guide?

  • I've read the CONTRIBUTING guide
@czoido
Copy link
Contributor

czoido commented Oct 6, 2023

Hi @Ahajha,

Thanks for the question. The CMake build helper does indeed add the target argument, so you can use it like:

cmake.build(target="my_library")

@czoido czoido self-assigned this Oct 6, 2023
@Ahajha
Copy link
Author

Ahajha commented Oct 6, 2023

Excellent, that is quite useful, it must have been added since the last time I checked.

However, it only supports one argument, so if I have multiple things to build, I would either need two calls (which avoids potential parallelism) or resorting to the method described above. Could the target parameter be made to take either a string or list of strings?

@czoido
Copy link
Contributor

czoido commented Oct 6, 2023

Hi @Ahajha,

Thanks for the suggestion, I'll add it to be discussed with the team and let you know soon.

@czoido
Copy link
Contributor

czoido commented Oct 6, 2023

Hi @Ahajha,
We will change this to also accept multiple targets. I have added this to the 2.0.14 milestone.
Thanks a lot for reporting.

Update: I have submitted #14883 this will be in 2.0.14 as:

cmake.build(target=["target1", "target2"])

also valid:

cmake.build(target=["target1"])
cmake.build(target="target1")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants