Generate find-package before fetch-content

main
Duncan Ogilvie 8 months ago
parent d607b9028c
commit be0ef6d615

@ -900,6 +900,20 @@ void generate_cmake(const char *path, const parser::Project *parent_project) {
ofs << "}\n"; ofs << "}\n";
} }
if (!project.packages.empty()) {
comment("Packages");
for (const auto &dep : project.packages) {
auto version = dep.version;
if (version == "*")
version.clear();
auto required = dep.required ? "REQUIRED" : "";
auto config = dep.config ? "CONFIG" : "";
auto components = std::make_pair("COMPONENTS", dep.components);
ConditionScope cs(gen, dep.condition);
cmd("find_package")(dep.name, version, required, config, components).endl();
}
}
if (!project.contents.empty()) { if (!project.contents.empty()) {
cmd("include")("FetchContent").endl(); cmd("include")("FetchContent").endl();
if (!project.root()->vcpkg.enabled()) { if (!project.root()->vcpkg.enabled()) {
@ -935,20 +949,6 @@ void generate_cmake(const char *path, const parser::Project *parent_project) {
} }
} }
if (!project.packages.empty()) {
comment("Packages");
for (const auto &dep : project.packages) {
auto version = dep.version;
if (version == "*")
version.clear();
auto required = dep.required ? "REQUIRED" : "";
auto config = dep.config ? "CONFIG" : "";
auto components = std::make_pair("COMPONENTS", dep.components);
ConditionScope cs(gen, dep.condition);
cmd("find_package")(dep.name, version, required, config, components).endl();
}
}
auto add_subdir = [&](const std::string &dir) { auto add_subdir = [&](const std::string &dir) {
// clang-format off // clang-format off
comment("Subdirectory: " + dir); comment("Subdirectory: " + dir);

Loading…
Cancel
Save