Skip to content

Commit

Permalink
Merge pull request #131 from build-cpp/fetch-subdir
Browse files Browse the repository at this point in the history
Add [fetch-content].subdir
  • Loading branch information
mrexodia authored Nov 9, 2023
2 parents 58c7de1 + 771c80a commit 099b145
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions docs/cmake-toml.md
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ git = "https://github.com/myuser/gitcontent"
tag = "v0.1"
shallow = false
system = false
subdir = ""

[fetch-content.svncontent]
condition = "mycondition"
Expand All @@ -195,6 +196,8 @@ hash = "SHA1 502a4e25b8b209889c99c7fa0732102682c2e4ff"
sha1 = "502a4e25b8b209889c99c7fa0732102682c2e4ff"
```

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.

## Targets

```toml
Expand Down
1 change: 1 addition & 0 deletions include/project_parser.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ struct Content {
ConditionVector include_before;
ConditionVector include_after;
bool system;
std::string subdir;
};

enum MsvcRuntimeType {
Expand Down
2 changes: 2 additions & 0 deletions src/project_parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -507,6 +507,8 @@ Project::Project(const Project *parent, const std::string &path, bool build) : p
value = algo + "=" + value;
} else if (key == "hash") {
key = "URL_HASH";
} else if (key == "subdir") {
key = "SOURCE_SUBDIR";
} else if (is_cmake_arg(key)) {
// allow passthrough of ExternalProject options
} else if (!c.visisted(key)) {
Expand Down

0 comments on commit 099b145

Please sign in to comment.