Commit 764775c4 authored by Brad King's avatar Brad King
Browse files

Fix XCODE_ATTRIBUTE_..._LOCATION target property lookup

Refactoring in commit v3.5.0-rc1~272^2~16 (cmGeneratorTarget: Add API for
property keys, 2015-10-25) changed the Xcode generator implementation of
`XCODE_ATTRIBUTE_...` properties to use the target `GetProperty` method on each
`XCODE_ATTRIBUTE_...` property listed by `GetPropertyKeys` instead of looping
over the property entries directly.  This made the lookup of property names of
the form `XCODE_ATTRIBUTE_..._LOCATION` accidentally trigger the computed
property logic for the undocumented/legacy `<CONFIG>_LOCATION` property.  Of
course the computed property value is not the same as the value stored in the
`XCODE_ATTRIBUTE_..._LOCATION` property.  Fix the computed property logic to
avoid triggering on `XCODE_ATTRIBUTE_...` attributes.

Closes: #16319
parent f4475eb9
......@@ -1164,7 +1164,8 @@ const char* cmTarget::GetProperty(const std::string& prop,
}
}
// Support "<CONFIG>_LOCATION".
else if (cmHasLiteralSuffix(prop, "_LOCATION")) {
else if (cmHasLiteralSuffix(prop, "_LOCATION") &&
!cmHasLiteralPrefix(prop, "XCODE_ATTRIBUTE_")) {
std::string configName(prop.c_str(), prop.size() - 9);
if (configName != "IMPORTED") {
if (!this->HandleLocationPropertyPolicy(context)) {
......
include(RunCMake)
run_cmake(XcodeFileType)
run_cmake(XcodeAttributeLocation)
run_cmake(XcodeAttributeGenex)
run_cmake(XcodeAttributeGenexError)
run_cmake(XcodeObjectNeedsEscape)
......
set(expect "DEPLOYMENT_LOCATION = YES")
file(STRINGS ${RunCMake_TEST_BINARY_DIR}/XcodeAttributeLocation.xcodeproj/project.pbxproj actual
REGEX "DEPLOYMENT_LOCATION = .*;" 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()
enable_language(C)
add_executable(some main.c)
set_property(TARGET some PROPERTY XCODE_ATTRIBUTE_DEPLOYMENT_LOCATION YES)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment