summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/VS10ProjectWinCE/VsCEDebuggerDeploy-check.cmake
blob: dab1c33a3a9ace0ac80deb446130c799d0189ed7 (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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
set(vcProjectFile "${RunCMake_TEST_BINARY_DIR}/foo.vcxproj")
if(NOT EXISTS "${vcProjectFile}")
  set(RunCMake_TEST_FAILED "Project file ${vcProjectFile} does not exist.")
  return()
endif()


if( NOT ${CMAKE_SYSTEM_NAME} STREQUAL "WindowsCE" )
  set(RunCMake_TEST_FAILED "Test only valid for WindowsCE")
  return()
endif()


set(FoundCEAdditionalFiles FALSE)
set(FoundRemoteDirectory FALSE)
set(FoundToolsVersion4 FALSE)

file(STRINGS "${vcProjectFile}" lines)
foreach(line IN LISTS lines)
  if(line MATCHES "^ *<CEAdditionalFiles> *foo\\.dll\\|\\\\foo\\\\src\\\\dir\\\\on\\\\host\\|\\$\\(RemoteDirectory\\)\\|0;bar\\.dll\\|\\\\bar\\\\src\\\\dir\\|\\$\\(RemoteDirectory\\)bardir\\|0.*</CEAdditionalFiles> *$")
    set(FoundCEAdditionalFiles TRUE)
  elseif(line MATCHES " *<RemoteDirectory>[A-Za-z0-9\\]+</RemoteDirectory> *$")
    set(FoundRemoteDirectory TRUE)
  elseif(line MATCHES " *<Project +.*ToolsVersion=\"4.0\".*> *$")
    set(FoundToolsVersion4 TRUE)
  endif()
endforeach()

if(NOT FoundCEAdditionalFiles)
  set(RunCMake_TEST_FAILED "CEAddionalFiles not found or not set correctly.")
  return()
endif()

if(NOT FoundRemoteDirectory)
  set(RunCMake_TEST_FAILED "RemoteDirectory not found or not set correctly.")
  return()
endif()

if(NOT FoundToolsVersion4)
  set(RunCMake_TEST_FAILED "Failed to find correct ToolsVersion=\"4.0\" .")
  return()
endif()

#
# Test solution file deployment items.
#

set(vcSlnFile "${RunCMake_TEST_BINARY_DIR}/VsCEDebuggerDeploy.sln")
if(NOT EXISTS "${vcSlnFile}")
  set(RunCMake_TEST_FAILED "Solution file ${vcSlnFile} does not exist.")
  return()
endif()


if( NOT ${CMAKE_SYSTEM_NAME} STREQUAL "WindowsCE" )
  set(RunCMake_TEST_FAILED "Test only valid for WindowsCE")
  return()
endif()


set(FooProjGUID "")
set(FoundFooProj FALSE)
set(InFooProj FALSE)
set(FoundReleaseDeploy FALSE)
set(DeployConfigs Debug MinSizeRel RelWithDebInfo )

file(STRINGS "${vcSlnFile}" lines)
foreach(line IN LISTS lines)
#message(STATUS "${line}")
  if( (NOT InFooProj ) AND (line MATCHES "^[ \\t]*Project\\(\"{[A-F0-9-]+}\"\\) = \"foo\", \"foo.vcxproj\", \"({[A-F0-9-]+})\"[ \\t]*$"))
    # First, identify the GUID for the foo project, and record it.
    set(FoundFooProj TRUE)
    set(InFooProj TRUE)
    set(FooProjGUID ${CMAKE_MATCH_1})
  elseif(InFooProj AND line MATCHES "EndProject")
    set(InFooProj FALSE)
  elseif((NOT InFooProj) AND line MATCHES "${FooProjGUID}\\.Release.*\\.Deploy\\.0")
    # If foo's Release configuration is set to deploy, this is the error.
    set(FoundReleaseDeploy TRUE)
  endif()
  if( line MATCHES "{[A-F0-9-]+}\\.([^\\|]+).*\\.Deploy\\.0" )
    # Check that the other configurations ARE set to deploy.
    list( REMOVE_ITEM DeployConfigs ${CMAKE_MATCH_1})
  endif()
endforeach()

if(FoundReleaseDeploy)
  set(RunCMake_TEST_FAILED "Release deployment not inhibited by VS_NO_SOLUTION_DEPLOY_Release.")
  return()
endif()

if(NOT FoundFooProj)
  set(RunCMake_TEST_FAILED "Failed to find foo project in the solution.")
  return()
endif()

list(LENGTH DeployConfigs length)
if(  length GREATER 0 )
  set(RunCMake_TEST_FAILED "Failed to find Deploy lines for non-Release configurations. (${length})")
  return()
endif()