|
|
@ -579,8 +579,8 @@ void generate_cmake(const char *path, const parser::Project *parent_project) {
|
|
|
|
|
|
|
|
|
|
|
|
// Show a nicer error than vcpkg when specifying an invalid package name
|
|
|
|
// Show a nicer error than vcpkg when specifying an invalid package name
|
|
|
|
for (const auto &package : project.vcpkg.packages) {
|
|
|
|
for (const auto &package : project.vcpkg.packages) {
|
|
|
|
if (!vcpkg_valid_identifier(package)) {
|
|
|
|
if (!vcpkg_valid_identifier(package.name)) {
|
|
|
|
throw std::runtime_error("Invalid [vcpkg].packages name '" + package + "' (needs to be lowercase alphanumeric)");
|
|
|
|
throw std::runtime_error("Invalid [vcpkg].packages name '" + package.name + "' (needs to be lowercase alphanumeric)");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -611,10 +611,25 @@ void generate_cmake(const char *path, const parser::Project *parent_project) {
|
|
|
|
const auto &packages = project.vcpkg.packages;
|
|
|
|
const auto &packages = project.vcpkg.packages;
|
|
|
|
for (size_t i = 0; i < packages.size(); i++) {
|
|
|
|
for (size_t i = 0; i < packages.size(); i++) {
|
|
|
|
const auto &package = packages[i];
|
|
|
|
const auto &package = packages[i];
|
|
|
|
if (!vcpkg_valid_identifier(package)) {
|
|
|
|
if (!vcpkg_valid_identifier(package.name)) {
|
|
|
|
throw std::runtime_error("Invalid vcpkg package name '" + package + "'");
|
|
|
|
throw std::runtime_error("Invalid vcpkg package name '" + package.name + "'");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (package.features.empty()) {
|
|
|
|
|
|
|
|
ofs << " \"" << package.name << '\"';
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
ofs << " {\n";
|
|
|
|
|
|
|
|
ofs << " \"name\": \"" << package.name << "\",\n";
|
|
|
|
|
|
|
|
ofs << " \"features\": [";
|
|
|
|
|
|
|
|
for (size_t j = 0; j < package.features.size(); j++) {
|
|
|
|
|
|
|
|
const auto &feature = package.features[j];
|
|
|
|
|
|
|
|
ofs << '\"' << feature << '\"';
|
|
|
|
|
|
|
|
if (j + 1 < package.features.size()) {
|
|
|
|
|
|
|
|
ofs << ',';
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
ofs << "]\n";
|
|
|
|
|
|
|
|
ofs << " }";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
ofs << " \"" << package << '\"';
|
|
|
|
|
|
|
|
if (i + 1 < packages.size()) {
|
|
|
|
if (i + 1 < packages.size()) {
|
|
|
|
ofs << ',';
|
|
|
|
ofs << ',';
|
|
|
|
}
|
|
|
|
}
|
|
|
|