Skip to content

Commit

Permalink
doc: extend README mentioning shorthand syntax with options
Browse files Browse the repository at this point in the history
  • Loading branch information
SGSSGene committed Nov 7, 2024
1 parent d10daf7 commit 82b650b
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ Afterwards, any targets defined in the dependency can be used directly.

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

A single-argument compact syntax is also supported:
A shorthand syntax is also supported:

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

Additionally, the shorthand syntax can be used with the URI and combined with the other options from above:
```cmake
CPMAddPackage("gh:nlohmann/[email protected]"
OPTIONS "JSON_BuildTests OFF"
)
```

After calling `CPMAddPackage`, the following variables are defined in the local scope, where `<dependency>` is the name of the dependency.

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

0 comments on commit 82b650b

Please sign in to comment.