|
|
@ -139,7 +139,7 @@ struct Command {
|
|
|
|
|
|
|
|
|
|
|
|
std::string quote(const std::string &str) {
|
|
|
|
std::string quote(const std::string &str) {
|
|
|
|
// Don't quote arguments that don't need quoting
|
|
|
|
// 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) {
|
|
|
|
return str;
|
|
|
|
return str;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
std::string result;
|
|
|
|
std::string result;
|
|
|
@ -201,7 +201,7 @@ struct Command {
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
ss << ' ';
|
|
|
|
ss << ' ';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
ss << value;
|
|
|
|
ss << quote(value);
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -212,7 +212,9 @@ struct Command {
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
ss << ' ';
|
|
|
|
ss << ' ';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
ss << value;
|
|
|
|
std::stringstream tmp;
|
|
|
|
|
|
|
|
tmp << value;
|
|
|
|
|
|
|
|
ss << quote(tmp.str());
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -245,7 +247,7 @@ int generate_cmake(const char *path, bool root) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return Command(ss, indent, command);
|
|
|
|
return Command(ss, indent, command);
|
|
|
|
};
|
|
|
|
};
|
|
|
|
auto comment = [&ss](const char *comment) {
|
|
|
|
auto comment = [&ss](const std::string &comment) {
|
|
|
|
ss << "# " << comment << '\n';
|
|
|
|
ss << "# " << comment << '\n';
|
|
|
|
return CommandEndl(ss);
|
|
|
|
return CommandEndl(ss);
|
|
|
|
};
|
|
|
|
};
|
|
|
@ -427,13 +429,14 @@ int generate_cmake(const char *path, bool root) {
|
|
|
|
cmd("endif")();
|
|
|
|
cmd("endif")();
|
|
|
|
// clang-format on
|
|
|
|
// clang-format on
|
|
|
|
cmd("add_subdirectory")(dir);
|
|
|
|
cmd("add_subdirectory")(dir);
|
|
|
|
cmd("set")("CMAKE_FOLDER", "CMKR_CMAKE_FOLDER");
|
|
|
|
cmd("set")("CMAKE_FOLDER", "${CMKR_CMAKE_FOLDER}").endl();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
endl();
|
|
|
|
endl();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (!cmake.targets.empty()) {
|
|
|
|
if (!cmake.targets.empty()) {
|
|
|
|
for (const auto &target : cmake.targets) {
|
|
|
|
for (const auto &target : cmake.targets) {
|
|
|
|
|
|
|
|
comment("Target " + target.name);
|
|
|
|
if (!target.cmake_before.empty()) {
|
|
|
|
if (!target.cmake_before.empty()) {
|
|
|
|
ss << tolf(target.cmake_before) << "\n\n";
|
|
|
|
ss << tolf(target.cmake_before) << "\n\n";
|
|
|
|
}
|
|
|
|
}
|
|
|
|