Fix a bug in fetch-content generation

main
Duncan Ogilvie 3 years ago
parent 887086dc05
commit 9b0f18ee94

@ -718,11 +718,7 @@ void generate_cmake(const char *path, const parser::Project *parent_project) {
version_info = " (" + content.arguments.at("SVN_REVISION") + ")"; version_info = " (" + content.arguments.at("SVN_REVISION") + ")";
} }
cmd("message")("STATUS", "Fetching " + content.name + version_info + "..."); cmd("message")("STATUS", "Fetching " + content.name + version_info + "...");
ss << "FetchContent_Declare(\n\t" << content.name << "\n"; cmd("FetchContent_Declare")(content.name, content.arguments);
for (const auto &arg : content.arguments) {
ss << "\t" << arg.first << "\n\t\t" << arg.second << "\n";
}
ss << ")\n";
cmd("FetchContent_MakeAvailable")(content.name).endl(); cmd("FetchContent_MakeAvailable")(content.name).endl();
gen.conditional_includes(content.include_after); gen.conditional_includes(content.include_after);

@ -426,10 +426,13 @@ Project::Project(const Project *parent, const std::string &path, bool build) {
throw std::runtime_error(format_key_error("Unknown key '" + argItr.first + "'", argItr.first, argItr.second)); throw std::runtime_error(format_key_error("Unknown key '" + argItr.first + "'", argItr.first, argItr.second));
} }
c.visit(argItr.first); // Make sure not to emit keys like "condition" in the FetchContent call
if (!c.visisted(key)) {
content.arguments.emplace(key, value); content.arguments.emplace(key, value);
} }
c.visit(argItr.first);
}
contents.emplace_back(std::move(content)); contents.emplace_back(std::move(content));
} }
} }

Loading…
Cancel
Save