~paparazzi-uav/paparazzi/v5.0-manual

« back to all changes in this revision

Viewing changes to sw/ext/opencv_bebop/opencv/cmake/OpenCVCompilerOptions.cmake

  • Committer: Paparazzi buildbot
  • Date: 2016-05-18 15:00:29 UTC
  • Revision ID: felix.ruess+docbot@gmail.com-20160518150029-e8lgzi5kvb4p7un9
Manual import commit 4b8bbb730080dac23cf816b98908dacfabe2a8ec from v5.0 branch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
if(MINGW OR (X86 AND UNIX AND NOT APPLE))
 
2
  # mingw compiler is known to produce unstable SSE code with -O3 hence we are trying to use -O2 instead
 
3
  if(CMAKE_COMPILER_IS_GNUCXX)
 
4
    foreach(flags CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_RELEASE CMAKE_CXX_FLAGS_DEBUG)
 
5
      string(REPLACE "-O3" "-O2" ${flags} "${${flags}}")
 
6
    endforeach()
 
7
  endif()
 
8
 
 
9
  if(CMAKE_COMPILER_IS_GNUCC)
 
10
    foreach(flags CMAKE_C_FLAGS CMAKE_C_FLAGS_RELEASE CMAKE_C_FLAGS_DEBUG)
 
11
      string(REPLACE "-O3" "-O2" ${flags} "${${flags}}")
 
12
    endforeach()
 
13
  endif()
 
14
endif()
 
15
 
 
16
if(MSVC)
 
17
  string(REGEX REPLACE "^  *| * $" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
 
18
  string(REGEX REPLACE "^  *| * $" "" CMAKE_CXX_FLAGS_INIT "${CMAKE_CXX_FLAGS_INIT}")
 
19
  if(CMAKE_CXX_FLAGS STREQUAL CMAKE_CXX_FLAGS_INIT)
 
20
    # override cmake default exception handling option
 
21
    string(REPLACE "/EHsc" "/EHa" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
 
22
    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}"  CACHE STRING "Flags used by the compiler during all build types." FORCE)
 
23
  endif()
 
24
endif()
 
25
 
 
26
set(OPENCV_EXTRA_FLAGS "")
 
27
set(OPENCV_EXTRA_C_FLAGS "")
 
28
set(OPENCV_EXTRA_CXX_FLAGS "")
 
29
set(OPENCV_EXTRA_FLAGS_RELEASE "")
 
30
set(OPENCV_EXTRA_FLAGS_DEBUG "")
 
31
set(OPENCV_EXTRA_EXE_LINKER_FLAGS "")
 
32
set(OPENCV_EXTRA_EXE_LINKER_FLAGS_RELEASE "")
 
33
set(OPENCV_EXTRA_EXE_LINKER_FLAGS_DEBUG "")
 
34
 
 
35
macro(add_extra_compiler_option option)
 
36
  if(CMAKE_BUILD_TYPE)
 
37
    set(CMAKE_TRY_COMPILE_CONFIGURATION ${CMAKE_BUILD_TYPE})
 
38
  endif()
 
39
  ocv_check_flag_support(CXX "${option}" _varname "${OPENCV_EXTRA_CXX_FLAGS} ${ARGN}")
 
40
  if(${_varname})
 
41
    set(OPENCV_EXTRA_CXX_FLAGS "${OPENCV_EXTRA_CXX_FLAGS} ${option}")
 
42
  endif()
 
43
 
 
44
  ocv_check_flag_support(C "${option}" _varname "${OPENCV_EXTRA_C_FLAGS} ${ARGN}")
 
45
  if(${_varname})
 
46
    set(OPENCV_EXTRA_C_FLAGS "${OPENCV_EXTRA_C_FLAGS} ${option}")
 
47
  endif()
 
48
endmacro()
 
49
 
 
50
# Gets environment variable and puts its value to the corresponding preprocessor definition
 
51
# Useful for WINRT that has no access to environment variables
 
52
macro(add_env_definitions option)
 
53
  set(value $ENV{${option}})
 
54
  if("${value}" STREQUAL "")
 
55
    message(WARNING "${option} environment variable is empty. Please set it to appropriate location to get correct results")
 
56
  else()
 
57
    string(REPLACE "\\" "\\\\" value ${value})
 
58
  endif()
 
59
  add_definitions("-D${option}=\"${value}\"")
 
60
endmacro()
 
61
 
 
62
# OpenCV fails some tests when 'char' is 'unsigned' by default
 
63
add_extra_compiler_option(-fsigned-char)
 
64
 
 
65
if(MINGW)
 
66
  # http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40838
 
67
  # here we are trying to workaround the problem
 
68
  add_extra_compiler_option(-mstackrealign)
 
69
  if(NOT HAVE_CXX_MSTACKREALIGN)
 
70
    add_extra_compiler_option(-mpreferred-stack-boundary=2)
 
71
  endif()
 
72
endif()
 
73
 
 
74
if(CMAKE_COMPILER_IS_GNUCXX)
 
75
  # High level of warnings.
 
76
  add_extra_compiler_option(-W)
 
77
  add_extra_compiler_option(-Wall)
 
78
  add_extra_compiler_option(-Werror=return-type)
 
79
  add_extra_compiler_option(-Werror=non-virtual-dtor)
 
80
  add_extra_compiler_option(-Werror=address)
 
81
  add_extra_compiler_option(-Werror=sequence-point)
 
82
  add_extra_compiler_option(-Wformat)
 
83
  add_extra_compiler_option(-Werror=format-security -Wformat)
 
84
  add_extra_compiler_option(-Wmissing-declarations)
 
85
  add_extra_compiler_option(-Wmissing-prototypes)
 
86
  add_extra_compiler_option(-Wstrict-prototypes)
 
87
  add_extra_compiler_option(-Wundef)
 
88
  add_extra_compiler_option(-Winit-self)
 
89
  add_extra_compiler_option(-Wpointer-arith)
 
90
  add_extra_compiler_option(-Wshadow)
 
91
  add_extra_compiler_option(-Wsign-promo)
 
92
 
 
93
  if(ENABLE_NOISY_WARNINGS)
 
94
    add_extra_compiler_option(-Wcast-align)
 
95
    add_extra_compiler_option(-Wstrict-aliasing=2)
 
96
  else()
 
97
    add_extra_compiler_option(-Wno-narrowing)
 
98
    add_extra_compiler_option(-Wno-delete-non-virtual-dtor)
 
99
    add_extra_compiler_option(-Wno-unnamed-type-template-args)
 
100
  endif()
 
101
  add_extra_compiler_option(-fdiagnostics-show-option)
 
102
 
 
103
  # The -Wno-long-long is required in 64bit systems when including sytem headers.
 
104
  if(X86_64)
 
105
    add_extra_compiler_option(-Wno-long-long)
 
106
  endif()
 
107
 
 
108
  # We need pthread's
 
109
  if(UNIX AND NOT ANDROID AND NOT (APPLE AND CMAKE_COMPILER_IS_CLANGCXX))
 
110
    add_extra_compiler_option(-pthread)
 
111
  endif()
 
112
 
 
113
  if(CMAKE_COMPILER_IS_CLANGCXX)
 
114
    add_extra_compiler_option(-Qunused-arguments)
 
115
  endif()
 
116
 
 
117
  if(OPENCV_WARNINGS_ARE_ERRORS)
 
118
    add_extra_compiler_option(-Werror)
 
119
  endif()
 
120
 
 
121
  if(X86 AND NOT MINGW64 AND NOT X86_64 AND NOT APPLE)
 
122
    add_extra_compiler_option(-march=i686)
 
123
  endif()
 
124
 
 
125
  if(APPLE)
 
126
    add_extra_compiler_option(-Wno-semicolon-before-method-body)
 
127
  endif()
 
128
 
 
129
  # Other optimizations
 
130
  if(ENABLE_OMIT_FRAME_POINTER)
 
131
    add_extra_compiler_option(-fomit-frame-pointer)
 
132
  else()
 
133
    add_extra_compiler_option(-fno-omit-frame-pointer)
 
134
  endif()
 
135
  if(ENABLE_FAST_MATH)
 
136
    add_extra_compiler_option(-ffast-math)
 
137
  endif()
 
138
  if(ENABLE_POWERPC)
 
139
    add_extra_compiler_option("-mcpu=G3 -mtune=G5")
 
140
  endif()
 
141
  if(ENABLE_SSE)
 
142
    add_extra_compiler_option(-msse)
 
143
  endif()
 
144
  if(ENABLE_SSE2)
 
145
    add_extra_compiler_option(-msse2)
 
146
  elseif(X86 OR X86_64)
 
147
    add_extra_compiler_option(-mno-sse2)
 
148
  endif()
 
149
  if(ENABLE_NEON)
 
150
    add_extra_compiler_option("-mfpu=neon")
 
151
  endif()
 
152
  if(ENABLE_VFPV3 AND NOT ENABLE_NEON)
 
153
    add_extra_compiler_option("-mfpu=vfpv3")
 
154
  endif()
 
155
 
 
156
  # SSE3 and further should be disabled under MingW because it generates compiler errors
 
157
  if(NOT MINGW)
 
158
    if(ENABLE_AVX)
 
159
      add_extra_compiler_option(-mavx)
 
160
    elseif(X86 OR X86_64)
 
161
      add_extra_compiler_option(-mno-avx)
 
162
    endif()
 
163
    if(ENABLE_AVX2)
 
164
      add_extra_compiler_option(-mavx2)
 
165
 
 
166
      if(ENABLE_FMA3)
 
167
        add_extra_compiler_option(-mfma)
 
168
      endif()
 
169
    endif()
 
170
 
 
171
    # GCC depresses SSEx instructions when -mavx is used. Instead, it generates new AVX instructions or AVX equivalence for all SSEx instructions when needed.
 
172
    if(NOT OPENCV_EXTRA_CXX_FLAGS MATCHES "-mavx")
 
173
      if(ENABLE_SSE3)
 
174
        add_extra_compiler_option(-msse3)
 
175
      elseif(X86 OR X86_64)
 
176
        add_extra_compiler_option(-mno-sse3)
 
177
      endif()
 
178
 
 
179
      if(ENABLE_SSSE3)
 
180
        add_extra_compiler_option(-mssse3)
 
181
      elseif(X86 OR X86_64)
 
182
        add_extra_compiler_option(-mno-ssse3)
 
183
      endif()
 
184
 
 
185
      if(ENABLE_SSE41)
 
186
        add_extra_compiler_option(-msse4.1)
 
187
      elseif(X86 OR X86_64)
 
188
        add_extra_compiler_option(-mno-sse4.1)
 
189
      endif()
 
190
 
 
191
      if(ENABLE_SSE42)
 
192
        add_extra_compiler_option(-msse4.2)
 
193
      elseif(X86 OR X86_64)
 
194
        add_extra_compiler_option(-mno-sse4.2)
 
195
      endif()
 
196
 
 
197
      if(ENABLE_POPCNT)
 
198
        add_extra_compiler_option(-mpopcnt)
 
199
      endif()
 
200
    endif()
 
201
  endif(NOT MINGW)
 
202
 
 
203
  if(X86 OR X86_64)
 
204
    if(NOT APPLE AND CMAKE_SIZEOF_VOID_P EQUAL 4)
 
205
      if(OPENCV_EXTRA_CXX_FLAGS MATCHES "-m(sse2|avx)")
 
206
        add_extra_compiler_option(-mfpmath=sse)# !! important - be on the same wave with x64 compilers
 
207
      else()
 
208
        add_extra_compiler_option(-mfpmath=387)
 
209
      endif()
 
210
    endif()
 
211
  endif()
 
212
 
 
213
  # Profiling?
 
214
  if(ENABLE_PROFILING)
 
215
    add_extra_compiler_option("-pg -g")
 
216
    # turn off incompatible options
 
217
    foreach(flags CMAKE_CXX_FLAGS CMAKE_C_FLAGS CMAKE_CXX_FLAGS_RELEASE CMAKE_C_FLAGS_RELEASE CMAKE_CXX_FLAGS_DEBUG CMAKE_C_FLAGS_DEBUG
 
218
                  OPENCV_EXTRA_FLAGS_RELEASE OPENCV_EXTRA_FLAGS_DEBUG OPENCV_EXTRA_C_FLAGS OPENCV_EXTRA_CXX_FLAGS)
 
219
      string(REPLACE "-fomit-frame-pointer" "" ${flags} "${${flags}}")
 
220
      string(REPLACE "-ffunction-sections" "" ${flags} "${${flags}}")
 
221
    endforeach()
 
222
  elseif(NOT APPLE AND NOT ANDROID)
 
223
    # Remove unreferenced functions: function level linking
 
224
    add_extra_compiler_option(-ffunction-sections)
 
225
  endif()
 
226
 
 
227
  if(ENABLE_COVERAGE)
 
228
    set(OPENCV_EXTRA_C_FLAGS "${OPENCV_EXTRA_C_FLAGS} --coverage")
 
229
    set(OPENCV_EXTRA_CXX_FLAGS "${OPENCV_EXTRA_CXX_FLAGS} --coverage")
 
230
  endif()
 
231
 
 
232
  set(OPENCV_EXTRA_FLAGS_RELEASE "${OPENCV_EXTRA_FLAGS_RELEASE} -DNDEBUG")
 
233
  set(OPENCV_EXTRA_FLAGS_DEBUG "${OPENCV_EXTRA_FLAGS_DEBUG} -O0 -DDEBUG -D_DEBUG")
 
234
endif()
 
235
 
 
236
if(MSVC)
 
237
  set(OPENCV_EXTRA_FLAGS "${OPENCV_EXTRA_FLAGS} /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE /D _SCL_SECURE_NO_WARNINGS")
 
238
  # 64-bit portability warnings, in MSVC80
 
239
  if(MSVC80)
 
240
    set(OPENCV_EXTRA_FLAGS "${OPENCV_EXTRA_FLAGS} /Wp64")
 
241
  endif()
 
242
 
 
243
  if(BUILD_WITH_DEBUG_INFO)
 
244
    set(OPENCV_EXTRA_EXE_LINKER_FLAGS_RELEASE "${OPENCV_EXTRA_EXE_LINKER_FLAGS_RELEASE} /debug")
 
245
  endif()
 
246
 
 
247
  # Remove unreferenced functions: function level linking
 
248
  set(OPENCV_EXTRA_FLAGS "${OPENCV_EXTRA_FLAGS} /Gy")
 
249
  if(NOT MSVC_VERSION LESS 1400)
 
250
    set(OPENCV_EXTRA_FLAGS "${OPENCV_EXTRA_FLAGS} /bigobj")
 
251
  endif()
 
252
  if(BUILD_WITH_DEBUG_INFO)
 
253
    set(OPENCV_EXTRA_FLAGS_RELEASE "${OPENCV_EXTRA_FLAGS_RELEASE} /Zi")
 
254
  endif()
 
255
 
 
256
  if(ENABLE_AVX2 AND NOT MSVC_VERSION LESS 1800)
 
257
    set(OPENCV_EXTRA_FLAGS "${OPENCV_EXTRA_FLAGS} /arch:AVX2")
 
258
  endif()
 
259
  if(ENABLE_AVX AND NOT MSVC_VERSION LESS 1600 AND NOT OPENCV_EXTRA_FLAGS MATCHES "/arch:")
 
260
    set(OPENCV_EXTRA_FLAGS "${OPENCV_EXTRA_FLAGS} /arch:AVX")
 
261
  endif()
 
262
 
 
263
  if(ENABLE_SSE4_1 AND CV_ICC AND NOT OPENCV_EXTRA_FLAGS MATCHES "/arch:")
 
264
    set(OPENCV_EXTRA_FLAGS "${OPENCV_EXTRA_FLAGS} /arch:SSE4.1")
 
265
  endif()
 
266
 
 
267
  if(ENABLE_SSE3 AND CV_ICC AND NOT OPENCV_EXTRA_FLAGS MATCHES "/arch:")
 
268
    set(OPENCV_EXTRA_FLAGS "${OPENCV_EXTRA_FLAGS} /arch:SSE3")
 
269
  endif()
 
270
 
 
271
  if(NOT MSVC64)
 
272
    # 64-bit MSVC compiler uses SSE/SSE2 by default
 
273
    if(ENABLE_SSE2 AND NOT OPENCV_EXTRA_FLAGS MATCHES "/arch:")
 
274
      set(OPENCV_EXTRA_FLAGS "${OPENCV_EXTRA_FLAGS} /arch:SSE2")
 
275
    endif()
 
276
    if(ENABLE_SSE AND NOT OPENCV_EXTRA_FLAGS MATCHES "/arch:")
 
277
      set(OPENCV_EXTRA_FLAGS "${OPENCV_EXTRA_FLAGS} /arch:SSE")
 
278
    endif()
 
279
  endif()
 
280
 
 
281
  if(ENABLE_SSE OR ENABLE_SSE2 OR ENABLE_SSE3 OR ENABLE_SSE4_1 OR ENABLE_AVX OR ENABLE_AVX2)
 
282
    set(OPENCV_EXTRA_FLAGS "${OPENCV_EXTRA_FLAGS} /Oi")
 
283
  endif()
 
284
 
 
285
  if(X86 OR X86_64)
 
286
    if(CMAKE_SIZEOF_VOID_P EQUAL 4 AND ENABLE_SSE2)
 
287
      set(OPENCV_EXTRA_FLAGS "${OPENCV_EXTRA_FLAGS} /fp:fast") # !! important - be on the same wave with x64 compilers
 
288
    endif()
 
289
  endif()
 
290
 
 
291
  if(OPENCV_WARNINGS_ARE_ERRORS)
 
292
    set(OPENCV_EXTRA_FLAGS "${OPENCV_EXTRA_FLAGS} /WX")
 
293
  endif()
 
294
endif()
 
295
 
 
296
if(MSVC12 AND NOT CMAKE_GENERATOR MATCHES "Visual Studio")
 
297
  set(OPENCV_EXTRA_C_FLAGS "${OPENCV_EXTRA_C_FLAGS} /FS")
 
298
  set(OPENCV_EXTRA_CXX_FLAGS "${OPENCV_EXTRA_CXX_FLAGS} /FS")
 
299
endif()
 
300
 
 
301
# Adding additional using directory for WindowsPhone 8.0 to get Windows.winmd properly
 
302
if(WINRT_PHONE AND WINRT_8_0)
 
303
  set(OPENCV_EXTRA_CXX_FLAGS "${OPENCV_EXTRA_CXX_FLAGS} /AI\$(WindowsSDK_MetadataPath)")
 
304
endif()
 
305
 
 
306
# Extra link libs if the user selects building static libs:
 
307
if(NOT BUILD_SHARED_LIBS AND CMAKE_COMPILER_IS_GNUCXX AND NOT ANDROID)
 
308
  # Android does not need these settings because they are already set by toolchain file
 
309
  set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} stdc++)
 
310
  set(OPENCV_EXTRA_FLAGS "-fPIC ${OPENCV_EXTRA_FLAGS}")
 
311
endif()
 
312
 
 
313
# Add user supplied extra options (optimization, etc...)
 
314
# ==========================================================
 
315
set(OPENCV_EXTRA_FLAGS         "${OPENCV_EXTRA_FLAGS}"         CACHE INTERNAL "Extra compiler options")
 
316
set(OPENCV_EXTRA_C_FLAGS       "${OPENCV_EXTRA_C_FLAGS}"       CACHE INTERNAL "Extra compiler options for C sources")
 
317
set(OPENCV_EXTRA_CXX_FLAGS     "${OPENCV_EXTRA_CXX_FLAGS}"     CACHE INTERNAL "Extra compiler options for C++ sources")
 
318
set(OPENCV_EXTRA_FLAGS_RELEASE "${OPENCV_EXTRA_FLAGS_RELEASE}" CACHE INTERNAL "Extra compiler options for Release build")
 
319
set(OPENCV_EXTRA_FLAGS_DEBUG   "${OPENCV_EXTRA_FLAGS_DEBUG}"   CACHE INTERNAL "Extra compiler options for Debug build")
 
320
set(OPENCV_EXTRA_EXE_LINKER_FLAGS         "${OPENCV_EXTRA_EXE_LINKER_FLAGS}"         CACHE INTERNAL "Extra linker flags")
 
321
set(OPENCV_EXTRA_EXE_LINKER_FLAGS_RELEASE "${OPENCV_EXTRA_EXE_LINKER_FLAGS_RELEASE}" CACHE INTERNAL "Extra linker flags for Release build")
 
322
set(OPENCV_EXTRA_EXE_LINKER_FLAGS_DEBUG   "${OPENCV_EXTRA_EXE_LINKER_FLAGS_DEBUG}"   CACHE INTERNAL "Extra linker flags for Debug build")
 
323
 
 
324
# set default visibility to hidden
 
325
if(CMAKE_COMPILER_IS_GNUCXX AND CMAKE_OPENCV_GCC_VERSION_NUM GREATER 399)
 
326
  add_extra_compiler_option(-fvisibility=hidden)
 
327
  add_extra_compiler_option(-fvisibility-inlines-hidden)
 
328
endif()
 
329
 
 
330
#combine all "extra" options
 
331
set(CMAKE_C_FLAGS           "${CMAKE_C_FLAGS} ${OPENCV_EXTRA_FLAGS} ${OPENCV_EXTRA_C_FLAGS}")
 
332
set(CMAKE_CXX_FLAGS         "${CMAKE_CXX_FLAGS} ${OPENCV_EXTRA_FLAGS} ${OPENCV_EXTRA_CXX_FLAGS}")
 
333
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} ${OPENCV_EXTRA_FLAGS_RELEASE}")
 
334
set(CMAKE_C_FLAGS_RELEASE   "${CMAKE_C_FLAGS_RELEASE} ${OPENCV_EXTRA_FLAGS_RELEASE}")
 
335
set(CMAKE_CXX_FLAGS_DEBUG   "${CMAKE_CXX_FLAGS_DEBUG} ${OPENCV_EXTRA_FLAGS_DEBUG}")
 
336
set(CMAKE_C_FLAGS_DEBUG     "${CMAKE_C_FLAGS_DEBUG} ${OPENCV_EXTRA_FLAGS_DEBUG}")
 
337
set(CMAKE_EXE_LINKER_FLAGS         "${CMAKE_EXE_LINKER_FLAGS} ${OPENCV_EXTRA_EXE_LINKER_FLAGS}")
 
338
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} ${OPENCV_EXTRA_EXE_LINKER_FLAGS_RELEASE}")
 
339
set(CMAKE_EXE_LINKER_FLAGS_DEBUG   "${CMAKE_EXE_LINKER_FLAGS_DEBUG} ${OPENCV_EXTRA_EXE_LINKER_FLAGS_DEBUG}")
 
340
 
 
341
if(MSVC)
 
342
  # avoid warnings from MSVC about overriding the /W* option
 
343
  # we replace /W3 with /W4 only for C++ files,
 
344
  # since all the 3rd-party libraries OpenCV uses are in C,
 
345
  # and we do not care about their warnings.
 
346
  string(REPLACE "/W3" "/W4" CMAKE_CXX_FLAGS         "${CMAKE_CXX_FLAGS}")
 
347
  string(REPLACE "/W3" "/W4" CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}")
 
348
  string(REPLACE "/W3" "/W4" CMAKE_CXX_FLAGS_DEBUG   "${CMAKE_CXX_FLAGS_DEBUG}")
 
349
 
 
350
  if(NOT ENABLE_NOISY_WARNINGS AND MSVC_VERSION EQUAL 1400)
 
351
    ocv_warnings_disable(CMAKE_CXX_FLAGS /wd4510 /wd4610 /wd4312 /wd4201 /wd4244 /wd4328 /wd4267)
 
352
  endif()
 
353
 
 
354
  # allow extern "C" functions throw exceptions
 
355
  foreach(flags CMAKE_C_FLAGS CMAKE_C_FLAGS_RELEASE CMAKE_C_FLAGS_RELEASE CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_RELEASE CMAKE_CXX_FLAGS_DEBUG)
 
356
    string(REPLACE "/EHsc-" "/EHs" ${flags} "${${flags}}")
 
357
    string(REPLACE "/EHsc"  "/EHs" ${flags} "${${flags}}")
 
358
 
 
359
    string(REPLACE "/Zm1000" "" ${flags} "${${flags}}")
 
360
  endforeach()
 
361
 
 
362
  if(NOT ENABLE_NOISY_WARNINGS)
 
363
    ocv_warnings_disable(CMAKE_CXX_FLAGS /wd4251) # class 'std::XXX' needs to have dll-interface to be used by clients of YYY
 
364
    ocv_warnings_disable(CMAKE_CXX_FLAGS /wd4324) # 'struct_name' : structure was padded due to __declspec(align())
 
365
    ocv_warnings_disable(CMAKE_CXX_FLAGS /wd4275) # non dll-interface class 'std::exception' used as base for dll-interface class 'cv::Exception'
 
366
    ocv_warnings_disable(CMAKE_CXX_FLAGS /wd4589) # Constructor of abstract class 'cv::ORB' ignores initializer for virtual base class 'cv::Algorithm'
 
367
  endif()
 
368
endif()