Merge pull request #55 from ZehMatt/fix/#54

Fix #54: Fix settings not being properly quoted
main
Duncan Ogilvie 3 years ago committed by GitHub
commit 50d4a905b6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -162,10 +162,11 @@ struct Command {
return "\"\""; return "\"\"";
} }
// 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 && // https://cmake.org/cmake/help/latest/manual/cmake-language.7.html#unquoted-argument
str.find(';') == std::string::npos) { // NOTE: Normally '/' does not require quoting according to the documentation but this has been the case here
// previously, so for backwards compatibility its still here.
if (str.find_first_of("()#\"\\'> |/") == str.npos)
return str; return str;
}
std::string result; std::string result;
result += "\""; result += "\"";
for (char ch : str) { for (char ch : str) {

16
tests/CMakeLists.txt generated

@ -14,7 +14,7 @@ add_test(
WORKING_DIRECTORY WORKING_DIRECTORY
"${CMAKE_CURRENT_LIST_DIR}/basic" "${CMAKE_CURRENT_LIST_DIR}/basic"
COMMAND COMMAND
$<TARGET_FILE:cmkr> "$<TARGET_FILE:cmkr>"
build build
) )
@ -24,7 +24,7 @@ add_test(
WORKING_DIRECTORY WORKING_DIRECTORY
"${CMAKE_CURRENT_LIST_DIR}/interface" "${CMAKE_CURRENT_LIST_DIR}/interface"
COMMAND COMMAND
$<TARGET_FILE:cmkr> "$<TARGET_FILE:cmkr>"
build build
) )
@ -34,7 +34,7 @@ add_test(
WORKING_DIRECTORY WORKING_DIRECTORY
"${CMAKE_CURRENT_LIST_DIR}/fetch-content" "${CMAKE_CURRENT_LIST_DIR}/fetch-content"
COMMAND COMMAND
$<TARGET_FILE:cmkr> "$<TARGET_FILE:cmkr>"
build build
) )
@ -44,7 +44,7 @@ add_test(
WORKING_DIRECTORY WORKING_DIRECTORY
"${CMAKE_CURRENT_LIST_DIR}/conditions" "${CMAKE_CURRENT_LIST_DIR}/conditions"
COMMAND COMMAND
$<TARGET_FILE:cmkr> "$<TARGET_FILE:cmkr>"
build build
) )
@ -54,7 +54,7 @@ add_test(
WORKING_DIRECTORY WORKING_DIRECTORY
"${CMAKE_CURRENT_LIST_DIR}/vcpkg" "${CMAKE_CURRENT_LIST_DIR}/vcpkg"
COMMAND COMMAND
$<TARGET_FILE:cmkr> "$<TARGET_FILE:cmkr>"
build build
) )
@ -64,7 +64,7 @@ add_test(
WORKING_DIRECTORY WORKING_DIRECTORY
"${CMAKE_CURRENT_LIST_DIR}/cxx-standard" "${CMAKE_CURRENT_LIST_DIR}/cxx-standard"
COMMAND COMMAND
$<TARGET_FILE:cmkr> "$<TARGET_FILE:cmkr>"
build build
) )
@ -74,7 +74,7 @@ add_test(
WORKING_DIRECTORY WORKING_DIRECTORY
"${CMAKE_CURRENT_LIST_DIR}/globbing" "${CMAKE_CURRENT_LIST_DIR}/globbing"
COMMAND COMMAND
$<TARGET_FILE:cmkr> "$<TARGET_FILE:cmkr>"
build build
) )
@ -84,7 +84,7 @@ add_test(
WORKING_DIRECTORY WORKING_DIRECTORY
"${CMAKE_CURRENT_LIST_DIR}/templates" "${CMAKE_CURRENT_LIST_DIR}/templates"
COMMAND COMMAND
$<TARGET_FILE:cmkr> "$<TARGET_FILE:cmkr>"
build build
) )

Loading…
Cancel
Save