From 18419297f48aea619808f078d6e8b2ffc76d115a Mon Sep 17 00:00:00 2001 From: cursey Date: Mon, 27 Dec 2021 16:49:11 -0800 Subject: [PATCH] Bootstrap Vcpkg prior to FetchContent --- src/cmake_generator.cpp | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/cmake_generator.cpp b/src/cmake_generator.cpp index 5c91f90..75242cb 100644 --- a/src/cmake_generator.cpp +++ b/src/cmake_generator.cpp @@ -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 &includes) { inject_includes(includes); }); 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()) { // Allow the user to specify a url or derive it from the version auto url = project.vcpkg.url; @@ -689,6 +676,19 @@ void generate_cmake(const char *path, const parser::Project *parent_project) { 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()) { comment("Packages"); for (const auto &dep : project.packages) {