Просмотр исходного кода

Xcode: Refine quoting rules for Strings

$ and . do not need to be quoted, but brackets and * must be to
not confuse the Xcode parser.
Gregor Jasny 10 лет назад
Родитель
Сommit
6693590f81
2 измененных файлов с 3 добавлено и 3 удалено
  1. 1 1
      Source/cmXCodeObject.cxx
  2. 2 2
      Tests/RunCMake/XcodeProject/XcodeFileType-check.cmake

+ 1 - 1
Source/cmXCodeObject.cxx

@@ -243,7 +243,7 @@ void cmXCodeObject::PrintString(std::ostream& os,std::string String)
   bool needQuote =
     (String.empty() ||
      String.find("//") != String.npos ||
-     String.find_first_of(" <>.+-=@$[],") != String.npos);
+     String.find_first_of(" <>+-*=@[](){},") != String.npos);
   const char* quote = needQuote? "\"" : "";
 
   // Print the string, quoted and escaped as necessary.

+ 2 - 2
Tests/RunCMake/XcodeProject/XcodeFileType-check.cmake

@@ -1,6 +1,6 @@
 set(expect-default "explicitFileType = sourcecode")
-set(expect-explicit "explicitFileType = \"sourcecode.c.h\"")
-set(expect-lastKnown "lastKnownFileType = \"sourcecode.c.h\"")
+set(expect-explicit "explicitFileType = sourcecode.c.h")
+set(expect-lastKnown "lastKnownFileType = sourcecode.c.h")
 foreach(src default explicit lastKnown)
   file(STRINGS ${RunCMake_TEST_BINARY_DIR}/XcodeFileType.xcodeproj/project.pbxproj actual-${src}
        REGEX "PBXFileReference.*src-${src}")