From 8ae64027991ce74a109b713beff075aa4753f4ae Mon Sep 17 00:00:00 2001 From: Alexander Nitsch Date: Mon, 23 Feb 2015 15:01:00 +0100 Subject: [PATCH 1/2] 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. --- cmake/OpenCVDetectCXXCompiler.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/OpenCVDetectCXXCompiler.cmake b/cmake/OpenCVDetectCXXCompiler.cmake index 674a6e4a8..a4adedce1 100644 --- a/cmake/OpenCVDetectCXXCompiler.cmake +++ b/cmake/OpenCVDetectCXXCompiler.cmake @@ -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() From a5b293b412ea7ec5b3ee6213a5faa09960a11ccb Mon Sep 17 00:00:00 2001 From: Alexander Nitsch Date: Tue, 24 Feb 2015 23:13:27 +0100 Subject: [PATCH 2/2] Fix setting of architecture for MinGW builds The architecture has been correctly determined earlier in this file. No need to do it again. --- cmake/OpenCVDetectCXXCompiler.cmake | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/cmake/OpenCVDetectCXXCompiler.cmake b/cmake/OpenCVDetectCXXCompiler.cmake index a4adedce1..ddf32c5cd 100644 --- a/cmake/OpenCVDetectCXXCompiler.cmake +++ b/cmake/OpenCVDetectCXXCompiler.cmake @@ -144,11 +144,7 @@ if(MSVC) elseif(MINGW) set(OpenCV_RUNTIME 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 "mingw64") - set(MINGW64 1) + if(MINGW64) set(OpenCV_ARCH x64) else() set(OpenCV_ARCH x86)