File: VsDefaultFlags-check.cmake

package info (click to toggle)
cmake 4.2.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 152,456 kB
  • sloc: ansic: 403,896; cpp: 303,920; sh: 4,105; python: 3,583; yacc: 3,106; lex: 1,279; f90: 538; asm: 471; lisp: 375; cs: 270; java: 266; fortran: 239; objc: 215; perl: 213; xml: 198; makefile: 111; javascript: 83; pascal: 63; tcl: 55; php: 25; ruby: 22
file content (180 lines) | stat: -rw-r--r-- 6,186 bytes parent folder | download | duplicates (2)
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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
macro(VsDefaultCompilerFlags_check tgt)
  set(vcProjectFile "${RunCMake_TEST_BINARY_DIR}/${tgt}.vcxproj")
  if(NOT EXISTS "${vcProjectFile}")
    set(RunCMake_TEST_FAILED "Project file ${tgt}.vcxproj does not exist.")
    return()
  endif()

  set(HAVE_BasicRuntimeChecks 0)
  set(HAVE_BufferSecurityCheck 0)
  set(HAVE_CallingConvention 0)
  set(HAVE_FloatingPointModel 0)
  set(HAVE_ForceConformanceInForLoopScope 0)
  set(HAVE_MinimalRebuild 0)
  set(HAVE_Optimization 0)
  set(HAVE_RemoveUnreferencedCodeData 0)
  set(HAVE_RuntimeLibrary 0)
  set(HAVE_SupportJustMyCode 0)
  set(HAVE_TreatWChar_tAsBuiltInType 0)

  file(STRINGS "${vcProjectFile}" lines)
  foreach(line IN LISTS lines)
    if(line MATCHES "^ *<BasicRuntimeChecks>Default</BasicRuntimeChecks>")
      set(HAVE_BasicRuntimeChecks 1)
    endif()
    if(line MATCHES "^ *<BufferSecurityCheck></BufferSecurityCheck>")
      set(HAVE_BufferSecurityCheck 1)
    endif()
    if(line MATCHES "^ *<CallingConvention></CallingConvention>")
      set(HAVE_CallingConvention 1)
    endif()
    if(line MATCHES "^ *<FloatingPointModel></FloatingPointModel>")
      set(HAVE_FloatingPointModel 1)
    endif()
    if(line MATCHES "^ *<ForceConformanceInForLoopScope></ForceConformanceInForLoopScope>")
      set(HAVE_ForceConformanceInForLoopScope 1)
    endif()
    if(line MATCHES "^ *<MinimalRebuild></MinimalRebuild>")
      set(HAVE_MinimalRebuild 1)
    endif()
    if(line MATCHES "^ *<Optimization>[^\\n<]*</Optimization>")
      set(HAVE_Optimization 1)
    endif()
    if(line MATCHES "^ *<RemoveUnreferencedCodeData></RemoveUnreferencedCodeData>")
      set(HAVE_RemoveUnreferencedCodeData 1)
    endif()
    if(line MATCHES "^ *<RuntimeLibrary>[^\\n<]*</RuntimeLibrary>")
      set(HAVE_RuntimeLibrary 1)
    endif()
    if(line MATCHES "^ *<SupportJustMyCode></SupportJustMyCode>")
      set(HAVE_SupportJustMyCode 1)
    endif()
    if(line MATCHES "^ *<TreatWChar_tAsBuiltInType></TreatWChar_tAsBuiltInType>")
      set(HAVE_TreatWChar_tAsBuiltInType 1)
    endif()
  endforeach()

  if(NOT HAVE_BasicRuntimeChecks)
    set(RunCMake_TEST_FAILED "Project file ${tgt}.vcxproj does not have a <BasicRuntimeChecks> property.")
    return()
  endif()

  if(NOT HAVE_BufferSecurityCheck)
    set(RunCMake_TEST_FAILED "Project file ${tgt}.vcxproj does not have a <BufferSecurityCheck> property.")
    return()
  endif()

  if(NOT HAVE_CallingConvention)
    set(RunCMake_TEST_FAILED "Project file ${tgt}.vcxproj does not have a <CallingConvention> property.")
    return()
  endif()

  if(NOT HAVE_FloatingPointModel)
    set(RunCMake_TEST_FAILED "Project file ${tgt}.vcxproj does not have a <FloatingPointModel> property.")
    return()
  endif()

  if(NOT HAVE_ForceConformanceInForLoopScope)
    set(RunCMake_TEST_FAILED "Project file ${tgt}.vcxproj does not have a <ForceConformanceInForLoopScope> property.")
    return()
  endif()

  if(NOT HAVE_MinimalRebuild)
    set(RunCMake_TEST_FAILED "Project file ${tgt}.vcxproj does not have a <MinimalRebuild> property.")
    return()
  endif()

  if(NOT HAVE_Optimization)
    set(RunCMake_TEST_FAILED "Project file ${tgt}.vcxproj does not have a <Optimization> property.")
    return()
  endif()

  if(NOT HAVE_RemoveUnreferencedCodeData)
    set(RunCMake_TEST_FAILED "Project file ${tgt}.vcxproj does not have a <RemoveUnreferencedCodeData> property.")
    return()
  endif()

  if(NOT HAVE_RuntimeLibrary)
    set(RunCMake_TEST_FAILED "Project file ${tgt}.vcxproj does not have a <RuntimeLibrary> property.")
    return()
  endif()

  if(NOT HAVE_SupportJustMyCode)
    set(RunCMake_TEST_FAILED "Project file ${tgt}.vcxproj does not have a <SupportJustMyCode> property.")
    return()
  endif()

  if(NOT HAVE_TreatWChar_tAsBuiltInType)
    set(RunCMake_TEST_FAILED "Project file ${tgt}.vcxproj does not have a <TreatWChar_tAsBuiltInType> property.")
    return()
  endif()
endmacro()

macro(VsDefaultLinkerFlags_check tgt)
  set(HAVE_DataExecutionPrevention 0)
  set(HAVE_ImageHasSafeExceptionHandlers 0)
  set(HAVE_LinkErrorReporting 0)
  set(HAVE_RandomizedBaseAddress 0)
  set(HAVE_SubSystem_Empty 0)
  set(HAVE_SubSystem_Console 0)

  file(STRINGS "${vcProjectFile}" lines)
  foreach(line IN LISTS lines)
    if(line MATCHES "^ *<DataExecutionPrevention></DataExecutionPrevention>")
      set(HAVE_DataExecutionPrevention 1)
    endif()
    if(line MATCHES "^ *<ImageHasSafeExceptionHandlers></ImageHasSafeExceptionHandlers>")
      set(HAVE_ImageHasSafeExceptionHandlers 1)
    endif()
    if(line MATCHES "^ *<LinkErrorReporting></LinkErrorReporting>")
      set(HAVE_LinkErrorReporting 1)
    endif()
    if(line MATCHES "^ *<RandomizedBaseAddress></RandomizedBaseAddress>")
      set(HAVE_RandomizedBaseAddress 1)
    endif()
    if(line MATCHES "^ *<SubSystem></SubSystem>")
      set(HAVE_SubSystem_Empty 1)
    endif()
    if(line MATCHES "^ *<SubSystem>Console</SubSystem>")
      set(HAVE_SubSystem_Console 1)
    endif()
  endforeach()

  if(NOT HAVE_DataExecutionPrevention)
    set(RunCMake_TEST_FAILED "Project file ${tgt}.vcxproj does not have a <DataExecutionPrevention> property.")
    return()
  endif()

  if(NOT HAVE_ImageHasSafeExceptionHandlers)
    set(RunCMake_TEST_FAILED "Project file ${tgt}.vcxproj does not have a <ImageHasSafeExceptionHandlers> property.")
    return()
  endif()

  if(NOT HAVE_LinkErrorReporting)
    set(RunCMake_TEST_FAILED "Project file ${tgt}.vcxproj does not have a <LinkErrorReporting> property.")
    return()
  endif()

  if(NOT HAVE_RandomizedBaseAddress)
    set(RunCMake_TEST_FAILED "Project file ${tgt}.vcxproj does not have a <RandomizedBaseAddress> property.")
    return()
  endif()

  if(HAVE_SubSystem_Empty)
    set(RunCMake_TEST_FAILED "Project file ${tgt}.vcxproj has a <SubSystem> property.")
    return()
  endif()

  if(NOT HAVE_SubSystem_Console)
    set(RunCMake_TEST_FAILED "Project file ${tgt}.vcxproj does not have a <SubSystem> property with 'Console' value.")
    return()
  endif()
endmacro()

VsDefaultCompilerFlags_check(emptyStatic)

VsDefaultCompilerFlags_check(emptyShared)
VsDefaultLinkerFlags_check(emptyShared)

VsDefaultCompilerFlags_check(main)
VsDefaultLinkerFlags_check(main)