Xcode: Propagate add_custom_command COMMENT to generated projects

Propagate the COMMENT section of add_custom_command(OUTPUT) as Xcode
Build Phase, if present. Otherwise fallback to the current behavior

Fixes: #27910
This commit is contained in:
Anton Tokar
2026-07-01 12:15:11 +03:00
committed by Brad King
parent b767f0fabb
commit de28f37ce4
6 changed files with 57 additions and 20 deletions

View File

@@ -0,0 +1,18 @@
set(xcProjectFile "${RunCMake_TEST_BINARY_DIR}/XcodeCustomCommandComment.xcodeproj/project.pbxproj")
if(NOT EXISTS "${xcProjectFile}")
set(RunCMake_TEST_FAILED "Project file ${xcProjectFile} does not exist.")
return()
endif()
set(foundComment 0)
file(STRINGS "${xcProjectFile}" lines)
foreach(line IN LISTS lines)
if(line MATCHES [[name = "My Custom Command Build Phase Name Debug";]])
set(foundComment 1)
break()
endif()
endforeach()
if(NOT foundComment)
set(RunCMake_TEST_FAILED "Did not find expected custom command comment in project.pbxproj")
endif()