Skip to content

Commit 771c80a

Browse files
committed
Add [fetch-content].subdir
Closes #98
1 parent 58c7de1 commit 771c80a

File tree

3 files changed

+6
-0
lines changed

3 files changed

+6
-0
lines changed

docs/cmake-toml.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,7 @@ git = "https://github.com/myuser/gitcontent"
180180
tag = "v0.1"
181181
shallow = false
182182
system = false
183+
subdir = ""
183184

184185
[fetch-content.svncontent]
185186
condition = "mycondition"
@@ -195,6 +196,8 @@ hash = "SHA1 502a4e25b8b209889c99c7fa0732102682c2e4ff"
195196
sha1 = "502a4e25b8b209889c99c7fa0732102682c2e4ff"
196197
```
197198

199+
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.
200+
198201
## Targets
199202

200203
```toml

include/project_parser.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@ struct Content {
156156
ConditionVector include_before;
157157
ConditionVector include_after;
158158
bool system;
159+
std::string subdir;
159160
};
160161

161162
enum MsvcRuntimeType {

src/project_parser.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -507,6 +507,8 @@ Project::Project(const Project *parent, const std::string &path, bool build) : p
507507
value = algo + "=" + value;
508508
} else if (key == "hash") {
509509
key = "URL_HASH";
510+
} else if (key == "subdir") {
511+
key = "SOURCE_SUBDIR";
510512
} else if (is_cmake_arg(key)) {
511513
// allow passthrough of ExternalProject options
512514
} else if (!c.visisted(key)) {

0 commit comments

Comments
 (0)