summaryrefslogtreecommitdiff
path: root/Tests/RunCMake/VS10Project/ExplicitCMakeLists-check.cmake
blob: b671e35807f613487202e0e41910b42320e52d77 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
set(vcProjectFile "${RunCMake_TEST_BINARY_DIR}/foo.vcxproj")
if(NOT EXISTS "${vcProjectFile}")
  set(RunCMake_TEST_FAILED "Project file ${vcProjectFile} does not exist.")
  return()
endif()

set(foundCMakeLists 0)
file(STRINGS "${vcProjectFile}" lines)
foreach(line IN LISTS lines)
  if(line MATCHES "<([A-Za-z0-9_]+) +Include=.*CMakeLists.txt")
    set(rule "${CMAKE_MATCH_1}")
    if(NOT rule STREQUAL "CustomBuild")
      set(RunCMake_TEST_FAILED "CMakeLists.txt referenced as ${rule} instead of CustomBuild")
      return()
    endif()
    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()