Skip to content

Commit acd3688

Browse files
committed
Fix [fetch-content]
1 parent 23c5713 commit acd3688

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/cmake.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ static void get_optional(const TomlBasicValue &v, const toml::key &ky, Condition
5555

5656
template <typename T>
5757
static void get_optional(const TomlBasicValue &v, const toml::key &ky, T &destination) {
58+
// TODO: this currently doesn't allow you to get an optional map<string, X>
5859
if (v.contains(ky)) {
5960
destination = toml::find<T>(v, ky);
6061
}
@@ -163,7 +164,9 @@ CMake::CMake(const std::string &path, bool build) {
163164
}
164165

165166
// TODO: refactor to std::vector<Content> instead of this hacky thing?
166-
get_optional(toml, "fetch-content", contents);
167+
if (toml.contains("fetch-content")) {
168+
contents = toml::find<decltype(contents)>(toml, "fetch-content");
169+
}
167170

168171
if (toml.contains("bin")) {
169172
throw std::runtime_error("[[bin]] has been renamed to [[target]]");

0 commit comments

Comments
 (0)