Skip to content

Commit 7408d42

Browse files
committed
Fix #54: Fix settings not being properly quoted
1 parent 16b2cbb commit 7408d42

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/cmake_generator.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -163,10 +163,11 @@ struct Command {
163163

164164
static std::string quote(const std::string &str) {
165165
// Don't quote arguments that don't need quoting
166-
if (str.find(' ') == std::string::npos && str.find('\"') == std::string::npos && str.find('/') == std::string::npos &&
167-
str.find(';') == std::string::npos) {
166+
// https://cmake.org/cmake/help/latest/manual/cmake-language.7.html#unquoted-argument
167+
// NOTE: Normally '/' does not require quoting according to the documentation but this has been the case here
168+
// previously, so for backwards compatibility its still here.
169+
if (str.find_first_of("()#\"\\'> |/") == str.npos)
168170
return str;
169-
}
170171
std::string result;
171172
result += "\"";
172173
for (char ch : str) {

0 commit comments

Comments
 (0)