Files
cmake/Tests/RunCMake/XcodeProject-Embed/EmbedFrameworksGenex-check.cmake
Tor Arne Vestbø 90c03329dd Xcode: Honor generator expressions in XCODE_EMBED_<type>
Evaluate the XCODE_EMBED_<type> target property through the generator
expression evaluator before building the copy-files phase.  Xcode shares
one copy-files build phase across all configurations, so the embedded set
cannot vary by configuration.  Reject any expression whose result depends
on the configuration, matching the existing per-source diagnostic.

Fixes #28082
2026-09-11 16:45:25 +02:00

15 lines
613 B
CMake

# The generator expression must resolve to the "embedded" framework target so
# that an "Embed Frameworks" copy-files phase is created. Were the expression
# left unevaluated, target lookup would fail and no such phase would exist.
execute_process(
COMMAND grep -c "Embed Frameworks"
${RunCMake_TEST_BINARY_DIR}/${test}.xcodeproj/project.pbxproj
OUTPUT_VARIABLE actualCount
OUTPUT_STRIP_TRAILING_WHITESPACE
)
if(NOT actualCount MATCHES "^[0-9]+$" OR actualCount EQUAL 0)
set(RunCMake_TEST_FAILED
"no Embed Frameworks phase in project; generator expression was not honored")
endif()