Skip to content

Commit 8ae2754

Browse files
authored
Merge pull request #45 from cursey/bootstrap-vcpkg-early
Bootstrap Vcpkg prior to FetchContent
2 parents bdaf5c9 + 1841929 commit 8ae2754

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

src/cmake_generator.cpp

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -583,19 +583,6 @@ void generate_cmake(const char *path, const parser::Project *parent_project) {
583583
gen.handle_condition(project.include_after, [&](const std::string &, const std::vector<std::string> &includes) { inject_includes(includes); });
584584
gen.handle_condition(project.cmake_after, [&](const std::string &, const std::string &cmake) { inject_cmake(cmake); });
585585

586-
if (!project.contents.empty()) {
587-
cmd("include")("FetchContent").endl();
588-
for (const auto &content : project.contents) {
589-
cmd("message")("STATUS", "Fetching " + content.name + "...");
590-
ss << "FetchContent_Declare(\n\t" << content.name << "\n";
591-
for (const auto &arg : content.arguments) {
592-
ss << "\t" << arg.first << "\n\t\t" << arg.second << "\n";
593-
}
594-
ss << ")\n";
595-
cmd("FetchContent_MakeAvailable")(content.name).endl();
596-
}
597-
}
598-
599586
if (!project.vcpkg.packages.empty()) {
600587
// Allow the user to specify a url or derive it from the version
601588
auto url = project.vcpkg.url;
@@ -689,6 +676,19 @@ void generate_cmake(const char *path, const parser::Project *parent_project) {
689676
ofs << "}\n";
690677
}
691678

679+
if (!project.contents.empty()) {
680+
cmd("include")("FetchContent").endl();
681+
for (const auto &content : project.contents) {
682+
cmd("message")("STATUS", "Fetching " + content.name + "...");
683+
ss << "FetchContent_Declare(\n\t" << content.name << "\n";
684+
for (const auto &arg : content.arguments) {
685+
ss << "\t" << arg.first << "\n\t\t" << arg.second << "\n";
686+
}
687+
ss << ")\n";
688+
cmd("FetchContent_MakeAvailable")(content.name).endl();
689+
}
690+
}
691+
692692
if (!project.packages.empty()) {
693693
comment("Packages");
694694
for (const auto &dep : project.packages) {

0 commit comments

Comments
 (0)