Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 13 additions & 13 deletions src/cmake_generator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.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;
Expand Down Expand Up @@ -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) {
Expand Down