Fix MinGW detection on x86

MinGW-w64 always uses "w64" as vendor key which the previously
used check for "64" anywhere in the target triplet matched. This
would lead to MinGW-w64 setups always being treated as x64.

Since we are actually interested in finding the "64" in the
triplet's operating system key, this fix makes sure to look for
"mingw64" and thus avoids the false match.

Fixes issue #3835. Credits to Lode Leroy for the original patch.
This commit is contained in:
Alexander Nitsch 2015-02-23 15:01:00 +01:00
parent dcc569ee5c
commit 8ae6402799

View File

@ -147,7 +147,7 @@ elseif(MINGW)
execute_process(COMMAND ${CMAKE_CXX_COMPILER} -dumpmachine
OUTPUT_VARIABLE OPENCV_GCC_TARGET_MACHINE
OUTPUT_STRIP_TRAILING_WHITESPACE)
if(CMAKE_OPENCV_GCC_TARGET_MACHINE MATCHES "64")
if(CMAKE_OPENCV_GCC_TARGET_MACHINE MATCHES "mingw64")
set(MINGW64 1)
set(OpenCV_ARCH x64)
else()