Merge branch 'array-properties'

vcpkg-wip
Duncan Ogilvie 4 years ago
commit c0bdbeb9d8

@ -186,8 +186,21 @@ CMake::CMake(const std::string &path, bool build) {
}
if (t.contains("properties")) {
using prop_map = tsl::ordered_map<std::string, std::string>;
target.properties = toml::find<prop_map>(t, "properties");
const auto &props = toml::find(t, "properties").as_table();
for (const auto &propKv : props) {
if (propKv.second.is_array()) {
std::string property_list;
for (const auto &list_val : propKv.second.as_array()) {
if (!property_list.empty()) {
property_list += ';';
}
property_list += list_val.as_string();
}
target.properties[propKv.first] = property_list;
} else {
target.properties[propKv.first] = propKv.second.as_string();
}
}
}
get_optional(t, "cmake-before", target.cmake_before);

@ -160,7 +160,8 @@ struct Command {
std::string quote(const std::string &str) {
// Don't quote arguments that don't need quoting
if (str.find(' ') == std::string::npos && str.find('\"') == std::string::npos && str.find('/') == std::string::npos) {
if (str.find(' ') == std::string::npos && str.find('\"') == std::string::npos && str.find('/') == std::string::npos &&
str.find(';') == std::string::npos) {
return str;
}
std::string result;
@ -442,7 +443,7 @@ int generate_cmake(const char *path, bool root) {
comment("Bootstrap vcpkg");
cmd("include")("${pmm_SOURCE_DIR}/pmm.cmake");
tsl::ordered_map<std::string, std::vector<std::string>> vcpkg_args;
vcpkg_args["REVISION"] = { cmake.vcpkg.version };
vcpkg_args["REVISION"] = {cmake.vcpkg.version};
vcpkg_args["REQUIRES"] = cmake.vcpkg.packages;
auto vcpkg = std::make_pair("VCPKG", vcpkg_args);
cmd("pmm")(vcpkg).endl();

Loading…
Cancel
Save