Merge pull request #45 from cursey/bootstrap-vcpkg-early

Bootstrap Vcpkg prior to FetchContent
main
Duncan Ogilvie 3 years ago committed by GitHub
commit 8ae2754994
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -583,19 +583,6 @@ void generate_cmake(const char *path, const parser::Project *parent_project) {
gen.handle_condition(project.include_after, [&](const std::string &, const std::vector<std::string> &includes) { inject_includes(includes); }); gen.handle_condition(project.include_after, [&](const std::string &, const std::vector<std::string> &includes) { inject_includes(includes); });
gen.handle_condition(project.cmake_after, [&](const std::string &, const std::string &cmake) { inject_cmake(cmake); }); gen.handle_condition(project.cmake_after, [&](const std::string &, const std::string &cmake) { inject_cmake(cmake); });
if (!project.contents.empty()) {
cmd("include")("FetchContent").endl();
for (const auto &content : project.contents) {
cmd("message")("STATUS", "Fetching " + content.name + "...");
ss << "FetchContent_Declare(\n\t" << content.name << "\n";
for (const auto &arg : content.arguments) {
ss << "\t" << arg.first << "\n\t\t" << arg.second << "\n";
}
ss << ")\n";
cmd("FetchContent_MakeAvailable")(content.name).endl();
}
}
if (!project.vcpkg.packages.empty()) { if (!project.vcpkg.packages.empty()) {
// Allow the user to specify a url or derive it from the version // Allow the user to specify a url or derive it from the version
auto url = project.vcpkg.url; auto url = project.vcpkg.url;
@ -689,6 +676,19 @@ void generate_cmake(const char *path, const parser::Project *parent_project) {
ofs << "}\n"; ofs << "}\n";
} }
if (!project.contents.empty()) {
cmd("include")("FetchContent").endl();
for (const auto &content : project.contents) {
cmd("message")("STATUS", "Fetching " + content.name + "...");
ss << "FetchContent_Declare(\n\t" << content.name << "\n";
for (const auto &arg : content.arguments) {
ss << "\t" << arg.first << "\n\t\t" << arg.second << "\n";
}
ss << ")\n";
cmd("FetchContent_MakeAvailable")(content.name).endl();
}
}
if (!project.packages.empty()) { if (!project.packages.empty()) {
comment("Packages"); comment("Packages");
for (const auto &dep : project.packages) { for (const auto &dep : project.packages) {

Loading…
Cancel
Save