CMake/Tests/RunCMake/XcodeProject/ImplicitCMakeLists-check.cmake
Brad King 0ce8a5c08d Xcode: Fix generated references to CMakeLists.txt files
Refactoring in commit 2d888e3390 (cmSourceFile: Rename mutating
GetFullPath() overload, 2019-08-29, v3.16.0-rc1~160^2) accidentally left
the paths to `CMakeLists.txt` files empty in generated Xcode project
files.

Fixes: #19927
2019-11-05 14:29:41 -05:00

21 lines
637 B
CMake

set(xcProjectFile "${RunCMake_TEST_BINARY_DIR}/ImplicitCMakeLists.xcodeproj/project.pbxproj")
if(NOT EXISTS "${xcProjectFile}")
set(RunCMake_TEST_FAILED "Project file ${xcProjectFile} does not exist.")
return()
endif()
set(foundCMakeLists 0)
file(STRINGS "${xcProjectFile}" lines)
foreach(line IN LISTS lines)
if(line MATCHES "PBXFileReference.*CMakeLists.txt")
if(foundCMakeLists)
set(RunCMake_TEST_FAILED "CMakeLists.txt referenced multiple times")
return()
endif()
set(foundCMakeLists 1)
endif()
endforeach()
if(NOT foundCMakeLists)
set(RunCMake_TEST_FAILED "CMakeLists.txt not referenced")
endif()