CMake/Tests/RunCMake/XcodeProject/XcodeObjectNeedsEscape-check.cmake
Gregor Jasny ba39d7e9d0 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.
2016-01-07 13:23:24 -05:00

8 lines
394 B
CMake

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()