Signed-off-by: Gregor Jasny <[email protected]>
---
 Help/prop_tgt/XCODE_ATTRIBUTE_an-attribute.rst              | 6 ++++++
 Source/cmGlobalXCodeGenerator.cxx                           | 5 ++++-
 Tests/RunCMake/XcodeProject/RunCMakeTest.cmake              | 1 +
 Tests/RunCMake/XcodeProject/XcodeAttributeGenex-check.cmake | 6 ++++++
 Tests/RunCMake/XcodeProject/XcodeAttributeGenex.cmake       | 4 ++++
 5 files changed, 21 insertions(+), 1 deletion(-)
 create mode 100644 Tests/RunCMake/XcodeProject/XcodeAttributeGenex-check.cmake
 create mode 100644 Tests/RunCMake/XcodeProject/XcodeAttributeGenex.cmake

diff --git a/Help/prop_tgt/XCODE_ATTRIBUTE_an-attribute.rst 
b/Help/prop_tgt/XCODE_ATTRIBUTE_an-attribute.rst
index de98c37..d978676 100644
--- a/Help/prop_tgt/XCODE_ATTRIBUTE_an-attribute.rst
+++ b/Help/prop_tgt/XCODE_ATTRIBUTE_an-attribute.rst
@@ -8,3 +8,9 @@ the generated Xcode project.  Ignored on other generators.
 
 See the :variable:`CMAKE_XCODE_ATTRIBUTE_<an-attribute>` variable
 to set attributes on all targets in a directory tree.
+
+Contents of ``CMAKE_XCODE_ATTRIBUTE_<an-attribute>`` may use
+"generator expressions" with the syntax ``$<...>``.  See the
+:manual:`cmake-generator-expressions(7)` manual for available
+expressions.  See the :manual:`cmake-buildsystem(7)` manual
+for more on defining buildsystem properties.
diff --git a/Source/cmGlobalXCodeGenerator.cxx 
b/Source/cmGlobalXCodeGenerator.cxx
index 30ed134..1f0a345 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -2436,8 +2436,11 @@ void 
cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
 
       if (!attribute.empty())
         {
+        cmListFileBacktrace backtrace = this->CurrentMakefile->GetBacktrace();
+        cmGeneratorExpression ge(&backtrace);
+        std::string processed = 
ge.Parse(i->second.GetValue())->Evaluate(this->CurrentMakefile, configName);
         buildSettings->AddAttribute(attribute.c_str(),
-                                    this->CreateString(i->second.GetValue()));
+                                    this->CreateString(processed));
         }
       }
     }
diff --git a/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake 
b/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake
index 8e4026b..35ff5df 100644
--- a/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake
+++ b/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake
@@ -1,3 +1,4 @@
 include(RunCMake)
 
 run_cmake(XcodeFileType)
+run_cmake(XcodeAttributeGenex)
diff --git a/Tests/RunCMake/XcodeProject/XcodeAttributeGenex-check.cmake 
b/Tests/RunCMake/XcodeProject/XcodeAttributeGenex-check.cmake
new file mode 100644
index 0000000..4f4ba0c
--- /dev/null
+++ b/Tests/RunCMake/XcodeProject/XcodeAttributeGenex-check.cmake
@@ -0,0 +1,6 @@
+set(expect "TEST_HOST = \"${RunCMake_TEST_BINARY_DIR}/.*/some\"")
+file(STRINGS 
${RunCMake_TEST_BINARY_DIR}/XcodeAttributeGenex.xcodeproj/project.pbxproj actual
+     REGEX "TEST_HOST = .*;" LIMIT_COUNT 1)
+if(NOT "${actual}" MATCHES "${expect}")
+  message(SEND_ERROR "does not match '${expect}':\n ${actual}")
+endif()
diff --git a/Tests/RunCMake/XcodeProject/XcodeAttributeGenex.cmake 
b/Tests/RunCMake/XcodeProject/XcodeAttributeGenex.cmake
new file mode 100644
index 0000000..760b882
--- /dev/null
+++ b/Tests/RunCMake/XcodeProject/XcodeAttributeGenex.cmake
@@ -0,0 +1,4 @@
+enable_language(C)
+add_executable(some main.c)
+add_executable(another main.c)
+set_property(TARGET another PROPERTY XCODE_ATTRIBUTE_TEST_HOST 
"$<TARGET_FILE:some>")
-- 
2.3.0

-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake-developers

Reply via email to