Merge topic 'xcode-quote-path'

dfd6f1f2 Xcode: Also quote strings containing // (#15487)
This commit is contained in:
Brad King 2015-04-08 09:06:59 -04:00 committed by CMake Topic Stage
commit 710968e371
5 changed files with 12 additions and 0 deletions

View File

@ -242,6 +242,7 @@ void cmXCodeObject::PrintString(std::ostream& os,std::string String)
// considered special by the Xcode project file parser. // considered special by the Xcode project file parser.
bool needQuote = bool needQuote =
(String.empty() || (String.empty() ||
String.find("//") != String.npos ||
String.find_first_of(" <>.+-=@$[],") != String.npos); String.find_first_of(" <>.+-=@$[],") != String.npos);
const char* quote = needQuote? "\"" : ""; const char* quote = needQuote? "\"" : "";

View File

@ -3,6 +3,7 @@ include(RunCMake)
run_cmake(XcodeFileType) run_cmake(XcodeFileType)
run_cmake(XcodeAttributeGenex) run_cmake(XcodeAttributeGenex)
run_cmake(XcodeAttributeGenexError) run_cmake(XcodeAttributeGenexError)
run_cmake(XcodeObjectNeedsQuote)
if (NOT XCODE_VERSION VERSION_LESS 6) if (NOT XCODE_VERSION VERSION_LESS 6)
run_cmake(XcodePlatformFrameworks) run_cmake(XcodePlatformFrameworks)
endif() endif()

View File

@ -0,0 +1,7 @@
set(expect "path = \"")
file(STRINGS ${RunCMake_TEST_BINARY_DIR}/XcodeObjectNeedsQuote.xcodeproj/project.pbxproj actual
REGEX "path = [^;]*someFileWithoutSpecialChars[^;]*;" 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()

View File

@ -0,0 +1,3 @@
enable_language(C)
add_library(some /${CMAKE_CURRENT_SOURCE_DIR}/someFileWithoutSpecialChars)
set_property(SOURCE /${CMAKE_CURRENT_SOURCE_DIR}/someFileWithoutSpecialChars PROPERTY LANGUAGE C)