summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/include_external_msproject/VSCSharpReference-check.cmake
blob: 71b8c1f9c6ba6ab95251527ef5b3b110784efcf2 (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
26
27
28
29
30
31
32
33
34
35
36
file(READ "${RunCMake_TEST_BINARY_DIR}/internal.vcxproj" all_build)

string(REGEX MATCH
  "<ProjectReference.Include=.external.csproj.>.*</ProjectReference>"
  ProjectReference
  ${all_build}
)

if(ProjectReference STREQUAL "")
  set(RunCMake_TEST_FAILED "${test} is being set unexpectedly.")
else()
  string(REGEX MATCH
    "<ReferenceOutputAssembly>.*</ReferenceOutputAssembly>"
    ReferenceOutputAssembly
    ${ProjectReference}
  )

  if(NOT ReferenceOutputAssembly STREQUAL "")
    string(REPLACE
      "<ReferenceOutputAssembly>"
      ""
      ReferenceOutputAssemblyValue
      ${ReferenceOutputAssembly}
    )
    string(REPLACE
      "</ReferenceOutputAssembly>"
      ""
      ReferenceOutputAssemblyValue
      ${ReferenceOutputAssemblyValue}
    )

    if(ReferenceOutputAssemblyValue MATCHES "[Fa][Ll][Ss][Ee]")
      set(RunCMake_TEST_FAILED "Referenced C# project with ReferenceOutputAssembly set to false.")
    endif()
  endif()
endif()