Files
CMake/Tests/RunCMake/XcodeProject/XcodeCustomCommandComment-check.cmake
Anton Tokar de28f37ce4 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
2026-07-01 12:10:03 -04:00

19 lines
576 B
CMake

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()