Xcode: Teach XCODE_ATTRIBUTE target properties about generator expressions
Signed-off-by: Gregor Jasny <gjasny@googlemail.com>
This commit is contained in:
parent
0ec1f45a13
commit
bf8f9c29e7
|
@ -8,3 +8,9 @@ the generated Xcode project. Ignored on other generators.
|
||||||
|
|
||||||
See the :variable:`CMAKE_XCODE_ATTRIBUTE_<an-attribute>` variable
|
See the :variable:`CMAKE_XCODE_ATTRIBUTE_<an-attribute>` variable
|
||||||
to set attributes on all targets in a directory tree.
|
to set attributes on all targets in a directory tree.
|
||||||
|
|
||||||
|
Contents of ``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.
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
xcode-attribute-genex
|
||||||
|
---------------------
|
||||||
|
|
||||||
|
* The :prop_tgt:`XCODE_ATTRIBUTE_<an-attribute>` target property learned
|
||||||
|
to support generator expressions.
|
|
@ -2436,8 +2436,11 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
|
||||||
|
|
||||||
if (!attribute.empty())
|
if (!attribute.empty())
|
||||||
{
|
{
|
||||||
|
cmGeneratorExpression ge;
|
||||||
|
std::string processed = ge.Parse(i->second.GetValue())
|
||||||
|
->Evaluate(this->CurrentMakefile, configName);
|
||||||
buildSettings->AddAttribute(attribute.c_str(),
|
buildSettings->AddAttribute(attribute.c_str(),
|
||||||
this->CreateString(i->second.GetValue()));
|
this->CreateString(processed));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
include(RunCMake)
|
include(RunCMake)
|
||||||
|
|
||||||
run_cmake(XcodeFileType)
|
run_cmake(XcodeFileType)
|
||||||
|
run_cmake(XcodeAttributeGenex)
|
||||||
|
run_cmake(XcodeAttributeGenexError)
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
set(expect "TEST_HOST = \"[^;\"]*Tests/RunCMake/XcodeProject/XcodeAttributeGenex-build/[^;\"/]*/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 "The actual project contains the line:\n ${actual}\n"
|
||||||
|
"which does not match expected regex:\n ${expect}\n")
|
||||||
|
endif()
|
|
@ -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>")
|
|
@ -0,0 +1 @@
|
||||||
|
1
|
|
@ -0,0 +1,6 @@
|
||||||
|
CMake Error:
|
||||||
|
Error evaluating generator expression:
|
||||||
|
|
||||||
|
\$<NOTAGENEX>
|
||||||
|
|
||||||
|
Expression did not evaluate to a known generator expression
|
|
@ -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 "$<NOTAGENEX>")
|
Loading…
Reference in New Issue