Skip to content

Conversation

SGSSGene
Copy link
Contributor

@SGSSGene SGSSGene commented Nov 7, 2024

(This is an alternative to PR #546 )
This allows to combine the shorthand syntax by using URI with additional arguments:

CPMAddPackage(URI "gh:nlohmann/[email protected]" OPTIONS "JSON_BUildTests OFF")

This is much shorter than the longer syntax way of writing:

CPMAddPackage (
  NAME nlohmann_json
  VERSION 3.9.1
  GITHUB_REPOSITORY nlohmann/json
  OPTIONS
    "JSON_BuildTests OFF"
)

Important difference to #546, it does not set EXCLUDE_FROM_ALL;YES;SYSTEM;YES;

Copy link
Member

@TheLartians TheLartians left a comment

Choose a reason for hiding this comment

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

Hey, thanks a lot for this alternative implementation and thanks for your patience, as I'm quite busy these days! I personally much prefer this alternative to the other PR, as it looks much cleaner and is not mixing different ways to pass arguments (I know it's a common CMake style, so this is a very subjective take). I was hoping to hear some input from @iboB on this, but I think he is very busy as well.

Important difference to #546, it does not set EXCLUDE_FROM_ALL;YES;SYSTEM;YES;

Can you elaborate what the advantage is? I think I it would be intuitive for both CPMAddPackage("gh:nlohmann/[email protected]") and CPMAddPackage(URI "gh:nlohmann/[email protected]") to work the same way, so IMO both versions should set the same flags.

Sorry again for taking so long to respond. I have some more time during the holidays, so happy to help get this merged asap.

@TheLartians
Copy link
Member

Can you elaborate what the advantage is?

I think I found the answer in the other PR:

Harder to document. Currently we have two cases: 1. normal usage, 2. shorthand syntax. With URI we kind of have to split the 'normal usage' into two cases. I don't see how this can be documented in any understandable way. (Assuming we don't delete the 2. shorthand syntax)

I see your concern, though I feel it's quite easy to understand in the docs:

All packages added using the shorthand syntax will be added using the EXCLUDE_FROM_ALL and SYSTEM flag.
...
Additionally, the shorthand syntax can be combined with the other options from above[ using the URI argument]:

@SGSSGene
Copy link
Contributor Author

PR #546 basic idea was, take the "short hand" syntax and allow extended options.
This PR took the standard approach and added a URI which is a short from for repo, name and version.
That is why I didn't touch EXCLUDE_FROM_ALL and SYSTEM.
But from what I understand, you would prefer a URI which allows a short form of repo, name and version + also sets EXCLUDE_FROM_ALL and SYSTEM.

I will adjust this PR accordingly

@SGSSGene SGSSGene force-pushed the feat/uri_with_options branch from 82b650b to 1cb8a5a Compare December 23, 2024 10:50
@SGSSGene
Copy link
Contributor Author

This new version automatically sets EXCLUDE_FROM_ALL and SYSTEM. I made sure that this can be overridden by setting EXCLUDE_FROM_ALL OFF or SYSTEM OFF. (And added a unit/integration test for this case).

I added another note below the CPMAddPackage(....) description noting the behavior of URI.

Copy link
Member

@TheLartians TheLartians left a comment

Choose a reason for hiding this comment

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

Thanks for the updates! I really like how it's turning out. There are some small stylistic and documentation issues left and then I'm happy to merge this!

@Richardk2n
Copy link

Dear distinguished Gentleman,
how's it going?

This allows to combine the shorthand syntax with URI and additional arguments:
```
CPMAddPackage(URI "gh:nlohmann/[email protected]" OPTIONS "JSON_BUildTests OFF")
```

This is much shorter than the longer syntax way of writing:
```
CPMAddPackage(
  NAME nlohmann_json
  VERSION 3.9.1
  GITHUB_REPOSITORY nlohmann/json
  OPTIONS
    "JSON_BuildTests OFF"
)
```
@SGSSGene SGSSGene force-pushed the feat/uri_with_options branch from 32900e9 to e372127 Compare April 28, 2025 08:21
@SGSSGene
Copy link
Contributor Author

Dear distinguished Gentleman, how's it going?

Thanks for the reminder!
I updated the PR.

@SGSSGene SGSSGene requested a review from TheLartians April 28, 2025 15:47
Copy link
Member

@TheLartians TheLartians left a comment

Choose a reason for hiding this comment

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

Thanks for the changes, I like how it turned out! As you've allowed maintainer commits and there's not much left I'll add the final touches mentioned below and merge once tests pass. :)

@TheLartians TheLartians merged commit d761438 into cpm-cmake:master May 3, 2025
11 checks passed
@TheLartians
Copy link
Member

URI argument support is released in v0.41.0 🎉
Thanks again the for PR and updates!

@SGSSGene SGSSGene deleted the feat/uri_with_options branch May 4, 2025 12:09
@SGSSGene
Copy link
Contributor Author

SGSSGene commented May 4, 2025

Thanks for the changes, I like how it turned out! As you've allowed maintainer commits and there's not much left I'll add the final touches mentioned below and merge once tests pass. :)

Yeah! Thank you!!!

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.

3 participants