@@ -65,6 +65,7 @@ Afterwards, any targets defined in the dependency can be used directly.
65
65
66
66
``` cmake
67
67
CPMAddPackage(
68
+ URI # shorthand including repo, name, version and tag (see shorthand syntax)
68
69
NAME # The unique name of the dependency (should be the exported target's name)
69
70
VERSION # The minimum version of the dependency (optional, defaults to 0)
70
71
PATCHES # Patch files to be applied sequentially using patch and PATCH_OPTIONS (optional)
@@ -87,7 +88,7 @@ If an additional optional parameter `SYSTEM` is set to a truthy value, the SYSTE
87
88
See the [ add_subdirectory ] ( https://cmake.org/cmake/help/latest/command/add_subdirectory.html?highlight=add_subdirectory )
88
89
and [ SYSTEM] ( https://cmake.org/cmake/help/latest/prop_tgt/SYSTEM.html#prop_tgt:SYSTEM ) target property for details.
89
90
90
- A single-argument compact syntax is also supported:
91
+ A shorthand syntax is also supported:
91
92
92
93
``` cmake
93
94
# A git package from a given uri with a version
@@ -111,6 +112,13 @@ CPMAddPackage("https://example.com/my-package-1.2.3.zip#MD5=68e20f674a48be38d60e
111
112
CPMAddPackage("https://example.com/my-package.zip@1.2.3")
112
113
```
113
114
115
+ Additionally, the shorthand syntax can be used with the URI and combined with the other options from above:
116
+ ``` cmake
117
+ CPMAddPackage("gh:nlohmann/json@3.9.1"
118
+ OPTIONS "JSON_BuildTests OFF"
119
+ )
120
+ ```
121
+
114
122
After calling ` CPMAddPackage ` , the following variables are defined in the local scope, where ` <dependency> ` is the name of the dependency.
115
123
116
124
- ` <dependency>_SOURCE_DIR ` is the path to the source of the dependency.
0 commit comments