This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake".
The branch, next has been updated via b03eb971c6e5a282c975cc84531fba7caee43f67 (commit) via 6d962fb9bf94585bb58044502c4ce0e0294e6395 (commit) via 90b50b2e28d32bcf239d3f6bc4d1114756a78827 (commit) from cab328fb37a3e12e75ce76879134d4ab206319bd (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b03eb971c6e5a282c975cc84531fba7caee43f67 commit b03eb971c6e5a282c975cc84531fba7caee43f67 Merge: cab328f 6d962fb Author: Gregor Jasny <gja...@googlemail.com> AuthorDate: Sat Jan 2 11:02:09 2016 -0500 Commit: CMake Topic Stage <kwro...@kitware.com> CommitDate: Sat Jan 2 11:02:09 2016 -0500 Merge topic 'xcode-escape-backslash' into next 6d962fb9 Xcode: Escape all backslashes in strings (#15328) 90b50b2e CMake Nightly Date Stamp https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=6d962fb9bf94585bb58044502c4ce0e0294e6395 commit 6d962fb9bf94585bb58044502c4ce0e0294e6395 Author: Gregor Jasny <gja...@googlemail.com> AuthorDate: Sun Dec 27 16:33:46 2015 +0100 Commit: Gregor Jasny <gja...@googlemail.com> CommitDate: Sat Jan 2 17:00:19 2016 +0100 Xcode: Escape all backslashes in strings (#15328) Before this change backslashes in strings were escaped during compile flags adds via AppendFlag(). But global flags like OTHER_CPLUSPLUSFLAGS are not added as flags but as plain strings so they were not escaped properly. Now the escaping is performed within cmXCodeObject::PrintString() which ensures that strings are always encoded. diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 475efa8..0290643 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -1693,7 +1693,6 @@ cmGlobalXCodeGenerator::AddCommandsToBuildPhase(cmXCodeObject* buildphase, makecmd += this->ConvertToRelativeForMake( (makefile+"$CONFIGURATION").c_str()); makecmd += " all"; - cmSystemTools::ReplaceString(makecmd, "\\ ", "\\\\ "); buildphase->AddAttribute("shellScript", this->CreateString(makecmd.c_str())); buildphase->AddAttribute("showEnvVarsInLog", @@ -4022,8 +4021,8 @@ void cmGlobalXCodeGenerator::AppendFlag(std::string& flags, // We escape a flag as follows: // - Place each flag in single quotes '' - // - Escape a single quote as \\' - // - Escape a backslash as \\\\ since it itself is an escape + // - Escape a single quote as \' + // - Escape a backslash as \\ since it itself is an escape // Note that in the code below we need one more level of escapes for // C string syntax in this source file. // @@ -4043,16 +4042,16 @@ void cmGlobalXCodeGenerator::AppendFlag(std::string& flags, { if (this->XcodeVersion >= 40) { - flags += "'\\\\''"; + flags += "'\\''"; } else { - flags += "\\\\'"; + flags += "\\'"; } } else if(*c == '\\') { - flags += "\\\\\\\\"; + flags += "\\\\"; } else { diff --git a/Source/cmXCodeObject.cxx b/Source/cmXCodeObject.cxx index c59c360..5bc34c1 100644 --- a/Source/cmXCodeObject.cxx +++ b/Source/cmXCodeObject.cxx @@ -255,9 +255,9 @@ void cmXCodeObject::PrintString(std::ostream& os,std::string String) for(std::string::const_iterator i = String.begin(); i != String.end(); ++i) { - if(*i == '"') + if(*i == '"' || *i == '\\') { - // Escape double-quotes. + // Escape double-quotes and backslashes. os << '\\'; } os << *i; diff --git a/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake b/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake index acc0075..395c74b 100644 --- a/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake +++ b/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake @@ -3,6 +3,7 @@ include(RunCMake) run_cmake(XcodeFileType) run_cmake(XcodeAttributeGenex) run_cmake(XcodeAttributeGenexError) +run_cmake(XcodeObjectNeedsEscape) run_cmake(XcodeObjectNeedsQuote) run_cmake(XcodeOptimizationFlags) run_cmake(XcodePreserveNonOptimizationFlags) diff --git a/Tests/RunCMake/XcodeProject/XcodeObjectNeedsEscape-check.cmake b/Tests/RunCMake/XcodeProject/XcodeObjectNeedsEscape-check.cmake new file mode 100644 index 0000000..c34e3fe --- /dev/null +++ b/Tests/RunCMake/XcodeProject/XcodeObjectNeedsEscape-check.cmake @@ -0,0 +1,7 @@ +set(expect "-DKDESRCDIR=\\\\\\\\\\\\\"foo\\\\\\\\\\\\\"") +file(STRINGS ${RunCMake_TEST_BINARY_DIR}/XcodeObjectNeedsEscape.xcodeproj/project.pbxproj actual + REGEX "OTHER_CPLUSPLUSFLAGS = [^;]*;" LIMIT_COUNT 1) +if(NOT "${actual}" MATCHES "${expect}") + message(SEND_ERROR "The actual project contains the line:\n ${actual}\n" + "which does not match expected regex:\n ${expect}\n") +endif() diff --git a/Tests/RunCMake/XcodeProject/XcodeObjectNeedsEscape.cmake b/Tests/RunCMake/XcodeProject/XcodeObjectNeedsEscape.cmake new file mode 100644 index 0000000..7606a19 --- /dev/null +++ b/Tests/RunCMake/XcodeProject/XcodeObjectNeedsEscape.cmake @@ -0,0 +1,3 @@ +enable_language(CXX) +string(APPEND CMAKE_CXX_FLAGS " -DKDESRCDIR=\\\"foo\\\"") +add_library(foo STATIC foo.cpp) ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- Source/cmGlobalXCodeGenerator.cxx | 11 +++++------ Source/cmXCodeObject.cxx | 4 ++-- Tests/RunCMake/XcodeProject/RunCMakeTest.cmake | 1 + ...cFlag-check.cmake => XcodeObjectNeedsEscape-check.cmake} | 4 ++-- Tests/RunCMake/XcodeProject/XcodeObjectNeedsEscape.cmake | 3 +++ 6 files changed, 14 insertions(+), 11 deletions(-) copy Tests/RunCMake/XcodeProject/{XcodePreserveObjcFlag-check.cmake => XcodeObjectNeedsEscape-check.cmake} (60%) create mode 100644 Tests/RunCMake/XcodeProject/XcodeObjectNeedsEscape.cmake hooks/post-receive -- CMake _______________________________________________ Cmake-commits mailing list Cmake-commits@cmake.org http://public.kitware.com/mailman/listinfo/cmake-commits