Xcode: Also quote strings containing // (#15487)
Otherwise those will be interpreted as start of a comment Signed-off-by: Gregor Jasny <gjasny@googlemail.com>
This commit is contained in:
parent
c6624cfdc1
commit
dfd6f1f290
|
@ -242,6 +242,7 @@ void cmXCodeObject::PrintString(std::ostream& os,std::string String)
|
|||
// considered special by the Xcode project file parser.
|
||||
bool needQuote =
|
||||
(String.empty() ||
|
||||
String.find("//") != String.npos ||
|
||||
String.find_first_of(" <>.+-=@$[],") != String.npos);
|
||||
const char* quote = needQuote? "\"" : "";
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@ include(RunCMake)
|
|||
run_cmake(XcodeFileType)
|
||||
run_cmake(XcodeAttributeGenex)
|
||||
run_cmake(XcodeAttributeGenexError)
|
||||
run_cmake(XcodeObjectNeedsQuote)
|
||||
if (NOT XCODE_VERSION VERSION_LESS 6)
|
||||
run_cmake(XcodePlatformFrameworks)
|
||||
endif()
|
||||
|
|
|
@ -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()
|
|
@ -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)
|
Loading…
Reference in New Issue