Skip to content

Commit 72e98e7

Browse files
committed
doc: extend README mentioning shorthand syntax with options
1 parent 0edaafc commit 72e98e7

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

README.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ Afterwards, any targets defined in the dependency can be used directly.
6565

6666
```cmake
6767
CPMAddPackage(
68+
URI # shorthand including repo, name, version and tag (see shorthand syntax)
6869
NAME # The unique name of the dependency (should be the exported target's name)
6970
VERSION # The minimum version of the dependency (optional, defaults to 0)
7071
PATCHES # Patch files to be applied sequentially using patch and PATCH_OPTIONS (optional)
@@ -88,7 +89,7 @@ If an additional optional parameter `SYSTEM` is set to a truthy value, the SYSTE
8889
See the [add_subdirectory ](https://cmake.org/cmake/help/latest/command/add_subdirectory.html?highlight=add_subdirectory)
8990
and [SYSTEM](https://cmake.org/cmake/help/latest/prop_tgt/SYSTEM.html#prop_tgt:SYSTEM) target property for details.
9091

91-
A single-argument compact syntax is also supported:
92+
A shorthand syntax is also supported:
9293

9394
```cmake
9495
# A git package from a given uri with a version
@@ -112,6 +113,13 @@ CPMAddPackage("https://example.com/my-package-1.2.3.zip#MD5=68e20f674a48be38d60e
112113
CPMAddPackage("https://example.com/[email protected]")
113114
```
114115

116+
Additionally, the shorthand syntax can be used with the long version, using the `URI` specifier.
117+
```cmake
118+
CPMAddPackage(URI "gh:nlohmann/[email protected]"
119+
OPTIONS "JSON_BuildTests OFF"
120+
)
121+
```
122+
115123
After calling `CPMAddPackage`, the following variables are defined in the local scope, where `<dependency>` is the name of the dependency.
116124

117125
- `<dependency>_SOURCE_DIR` is the path to the source of the dependency.

0 commit comments

Comments
 (0)