From 7408d42160ae875ea3a881256f75a50cc49ca5fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=CE=B6eh=20Matt?= <5415177+ZehMatt@users.noreply.github.com> Date: Fri, 1 Apr 2022 03:04:05 +0300 Subject: [PATCH 1/2] Fix #54: Fix settings not being properly quoted --- src/cmake_generator.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/cmake_generator.cpp b/src/cmake_generator.cpp index 2a86a06..1ffaea2 100644 --- a/src/cmake_generator.cpp +++ b/src/cmake_generator.cpp @@ -163,10 +163,11 @@ struct Command { static std::string quote(const std::string &str) { // 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 && - str.find(';') == std::string::npos) { + // https://cmake.org/cmake/help/latest/manual/cmake-language.7.html#unquoted-argument + // 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; - } std::string result; result += "\""; for (char ch : str) { From f957cec2dc11e88f506ab208a939125461e254dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=CE=B6eh=20Matt?= <5415177+ZehMatt@users.noreply.github.com> Date: Fri, 1 Apr 2022 03:37:04 +0300 Subject: [PATCH 2/2] Update CMakeLists.txt for tests --- tests/CMakeLists.txt | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 0b46624..bc48fde 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -14,7 +14,7 @@ add_test( WORKING_DIRECTORY "${CMAKE_CURRENT_LIST_DIR}/basic" COMMAND - $ + "$" build ) @@ -24,7 +24,7 @@ add_test( WORKING_DIRECTORY "${CMAKE_CURRENT_LIST_DIR}/interface" COMMAND - $ + "$" build ) @@ -34,7 +34,7 @@ add_test( WORKING_DIRECTORY "${CMAKE_CURRENT_LIST_DIR}/fetch-content" COMMAND - $ + "$" build ) @@ -44,7 +44,7 @@ add_test( WORKING_DIRECTORY "${CMAKE_CURRENT_LIST_DIR}/conditions" COMMAND - $ + "$" build ) @@ -54,7 +54,7 @@ add_test( WORKING_DIRECTORY "${CMAKE_CURRENT_LIST_DIR}/vcpkg" COMMAND - $ + "$" build ) @@ -64,7 +64,7 @@ add_test( WORKING_DIRECTORY "${CMAKE_CURRENT_LIST_DIR}/cxx-standard" COMMAND - $ + "$" build ) @@ -74,7 +74,7 @@ add_test( WORKING_DIRECTORY "${CMAKE_CURRENT_LIST_DIR}/globbing" COMMAND - $ + "$" build ) @@ -84,7 +84,7 @@ add_test( WORKING_DIRECTORY "${CMAKE_CURRENT_LIST_DIR}/templates" COMMAND - $ + "$" build )