Skip to content

Commit 084cbd6

Browse files
committed
Cleanup vcpkg.json generation a little
1 parent b4b0f53 commit 084cbd6

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/cmake_generator.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -611,24 +611,25 @@ void generate_cmake(const char *path, const parser::Project *parent_project) {
611611
const auto &packages = project.vcpkg.packages;
612612
for (size_t i = 0; i < packages.size(); i++) {
613613
const auto &package = packages[i];
614+
const auto &features = package.features;
614615
if (!vcpkg_valid_identifier(package.name)) {
615616
throw std::runtime_error("Invalid vcpkg package name '" + package.name + "'");
616617
}
617-
for (const auto &feature : package.features) {
618+
for (const auto &feature : features) {
618619
if (!vcpkg_valid_identifier(feature)) {
619620
throw std::runtime_error("Invalid vcpkg package feature '" + feature + "'");
620621
}
621622
}
622-
if (package.features.empty()) {
623+
if (features.empty()) {
623624
ofs << " \"" << package.name << '\"';
624625
} else {
625626
ofs << " {\n";
626627
ofs << " \"name\": \"" << package.name << "\",\n";
627628
ofs << " \"features\": [";
628-
for (size_t j = 0; j < package.features.size(); j++) {
629-
const auto &feature = package.features[j];
629+
for (size_t j = 0; j < features.size(); j++) {
630+
const auto &feature = features[j];
630631
ofs << '\"' << feature << '\"';
631-
if (j + 1 < package.features.size()) {
632+
if (j + 1 < features.size()) {
632633
ofs << ',';
633634
}
634635
}

0 commit comments

Comments
 (0)