Skip to content

Commit 50d4a90

Browse files
authored
Merge pull request #55 from ZehMatt/fix/#54
Fix #54: Fix settings not being properly quoted
2 parents 232e49e + f957cec commit 50d4a90

File tree

2 files changed

+12
-11
lines changed

2 files changed

+12
-11
lines changed

src/cmake_generator.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -162,10 +162,11 @@ struct Command {
162162
return "\"\"";
163163
}
164164
// Don't quote arguments that don't need quoting
165-
if (str.find(' ') == std::string::npos && str.find('\"') == std::string::npos && str.find('/') == std::string::npos &&
166-
str.find(';') == std::string::npos) {
165+
// https://cmake.org/cmake/help/latest/manual/cmake-language.7.html#unquoted-argument
166+
// NOTE: Normally '/' does not require quoting according to the documentation but this has been the case here
167+
// previously, so for backwards compatibility its still here.
168+
if (str.find_first_of("()#\"\\'> |/") == str.npos)
167169
return str;
168-
}
169170
std::string result;
170171
result += "\"";
171172
for (char ch : str) {

tests/CMakeLists.txt

Lines changed: 8 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)