Skip to content

Commit 501b26c

Browse files
committed
Update fetch-content documentation
1 parent 5bc3627 commit 501b26c

File tree

3 files changed

+16
-12
lines changed

3 files changed

+16
-12
lines changed

docs/cmake-toml.md

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -191,26 +191,28 @@ components = ["mycomponent"]
191191
**Note**: The `[fetch-content]` feature is unpolished and will likely change in a future release.
192192

193193
```toml
194+
# Include CMake project from git
194195
[fetch-content.gitcontent]
195196
condition = "mycondition"
196197
git = "https://github.com/myuser/gitcontent"
197198
tag = "v0.1"
198-
shallow = false
199+
shallow = false # shallow clone (--depth 1)
199200
system = false
200-
subdir = ""
201-
202-
[fetch-content.svncontent]
203-
condition = "mycondition"
204-
svn = "https://svn-host.com/url"
205-
rev = "svn_rev"
201+
subdir = "" # folder containing CMakeLists.txt
206202

203+
# Include a CMake project from a URL
207204
[fetch-content.urlcontent]
208205
condition = "mycondition"
209206
url = "https://content-host.com/urlcontent.zip"
210-
# These are equivalent, supported algorithms:
207+
# Other supported algorithms:
211208
# md5, sha1, sha224, sha256, sha384, sha512, sha3_224, sha3_256, sha3_384, sha3_512
212209
hash = "SHA1 502a4e25b8b209889c99c7fa0732102682c2e4ff"
213210
sha1 = "502a4e25b8b209889c99c7fa0732102682c2e4ff"
211+
212+
[fetch-content.svncontent]
213+
condition = "mycondition"
214+
svn = "https://svn-host.com/url"
215+
rev = "svn_rev"
214216
```
215217

216218
Table keys that match CMake variable names (`[A-Z_]+`) will be passed to the [`FetchContent_Declare`](https://cmake.org/cmake/help/latest/module/FetchContent.html#command:fetchcontent_declare) command.

docs/examples/fetch-content.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,9 @@ Downloads [fmt v7.1.3](https://fmt.dev/7.1.3/) from [GitHub](https://github.com)
1616
name = "fetch-content"
1717
description = "Fetching from git"
1818

19-
[fetch-content]
20-
fmt = { git = "https://github.com/fmtlib/fmt", tag = "7.1.3" }
19+
[fetch-content.fmt]
20+
git = "https://github.com/fmtlib/fmt"
21+
tag = "7.1.3"
2122

2223
[target.example]
2324
type = "executable"

tests/fetch-content/cmake.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@
44
name = "fetch-content"
55
description = "Fetching from git"
66

7-
[fetch-content]
8-
fmt = { git = "https://github.com/fmtlib/fmt", tag = "7.1.3" }
7+
[fetch-content.fmt]
8+
git = "https://github.com/fmtlib/fmt"
9+
tag = "7.1.3"
910

1011
[target.example]
1112
type = "executable"

0 commit comments

Comments
 (0)