Files
CMake/Tests/RunCMake/VS10Project/CMakeInputs-check.cmake
T
Alexander Neundorf df58dbb0e9 VS: Add CMake input files to ZERO_CHECK
Add all cmake input files to the `ZERO_CHECK` project.  Place files
under `CMAKE_SOURCE_DIR` in a folder structure matching the directory
structure.  This way they are easier to find, and Visual Studio does not
close them when reloading the project.

Fixes: #24557
2023-04-25 17:35:39 -04:00

26 lines
821 B
CMake

set(vcProjectFile "${RunCMake_TEST_BINARY_DIR}/ZERO_CHECK.vcxproj")
if(NOT EXISTS "${vcProjectFile}")
set(RunCMake_TEST_FAILED "Project file ${vcProjectFile} does not exist.")
return()
endif()
set(found_CMakeInputs 0)
file(STRINGS "${vcProjectFile}" lines)
foreach(line IN LISTS lines)
if(line MATCHES "<([A-Za-z0-9_]+) +Include=.*CMakeInputs.cmake")
set(rule "${CMAKE_MATCH_1}")
if(NOT rule STREQUAL "None")
set(RunCMake_TEST_FAILED "CMakeInputs.cmake referenced as ${rule} instead of None")
return()
endif()
if(found_CMakeInputs)
set(RunCMake_TEST_FAILED "CMakeInputs.cmake referenced multiple times")
return()
endif()
set(found_CMakeInputs 1)
endif()
endforeach()
if(NOT found_CMakeInputs)
set(RunCMake_TEST_FAILED "CMakeInputs.cmake not referenced")
endif()