Skip to content

Commit c0bdbeb

Browse files
committed
Merge branch 'array-properties'
2 parents 42725d0 + 1cf9240 commit c0bdbeb

File tree

2 files changed

+18
-4
lines changed

2 files changed

+18
-4
lines changed

src/cmkrlib/cmake.cpp

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,8 +186,21 @@ CMake::CMake(const std::string &path, bool build) {
186186
}
187187

188188
if (t.contains("properties")) {
189-
using prop_map = tsl::ordered_map<std::string, std::string>;
190-
target.properties = toml::find<prop_map>(t, "properties");
189+
const auto &props = toml::find(t, "properties").as_table();
190+
for (const auto &propKv : props) {
191+
if (propKv.second.is_array()) {
192+
std::string property_list;
193+
for (const auto &list_val : propKv.second.as_array()) {
194+
if (!property_list.empty()) {
195+
property_list += ';';
196+
}
197+
property_list += list_val.as_string();
198+
}
199+
target.properties[propKv.first] = property_list;
200+
} else {
201+
target.properties[propKv.first] = propKv.second.as_string();
202+
}
203+
}
191204
}
192205

193206
get_optional(t, "cmake-before", target.cmake_before);

src/cmkrlib/gen.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,8 @@ struct Command {
160160

161161
std::string quote(const std::string &str) {
162162
// Don't quote arguments that don't need quoting
163-
if (str.find(' ') == std::string::npos && str.find('\"') == std::string::npos && str.find('/') == std::string::npos) {
163+
if (str.find(' ') == std::string::npos && str.find('\"') == std::string::npos && str.find('/') == std::string::npos &&
164+
str.find(';') == std::string::npos) {
164165
return str;
165166
}
166167
std::string result;
@@ -442,7 +443,7 @@ int generate_cmake(const char *path, bool root) {
442443
comment("Bootstrap vcpkg");
443444
cmd("include")("${pmm_SOURCE_DIR}/pmm.cmake");
444445
tsl::ordered_map<std::string, std::vector<std::string>> vcpkg_args;
445-
vcpkg_args["REVISION"] = { cmake.vcpkg.version };
446+
vcpkg_args["REVISION"] = {cmake.vcpkg.version};
446447
vcpkg_args["REQUIRES"] = cmake.vcpkg.packages;
447448
auto vcpkg = std::make_pair("VCPKG", vcpkg_args);
448449
cmd("pmm")(vcpkg).endl();

0 commit comments

Comments
 (0)