From dde7c22fadac17946b676513974ddc4b306315da Mon Sep 17 00:00:00 2001 From: Alexander Nitsch Date: Sat, 7 Mar 2015 15:37:21 +0100 Subject: [PATCH 1/3] Fix MinGW architecture detection Fix typo that would always lead to detection of x86 for MinGW builds in the OpenCVConfig.cmake file. --- cmake/OpenCVConfig.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/OpenCVConfig.cmake b/cmake/OpenCVConfig.cmake index 2d80f765b5..5f5fa1aadb 100644 --- a/cmake/OpenCVConfig.cmake +++ b/cmake/OpenCVConfig.cmake @@ -84,7 +84,7 @@ elseif(MINGW) set(OpenCV_RUNTIME mingw) execute_process(COMMAND ${CMAKE_CXX_COMPILER} -dumpmachine - OUTPUT_VARIABLE OPENCV_GCC_TARGET_MACHINE + OUTPUT_VARIABLE CMAKE_OPENCV_GCC_TARGET_MACHINE OUTPUT_STRIP_TRAILING_WHITESPACE) if(CMAKE_OPENCV_GCC_TARGET_MACHINE MATCHES "64") set(MINGW64 1) From 13694c8ae871f9c4f3e46315f4fc6c3b9f4f0e38 Mon Sep 17 00:00:00 2001 From: Alexander Nitsch Date: Sat, 7 Mar 2015 15:49:48 +0100 Subject: [PATCH 2/3] Fix MinGW detection on x86 Make detection of x64 using the gcc's target triplet identical to the one used in cmake/OpenCVDetectCXXCompiler.cmake. Otherwise, MinGW-w64 setups will always be treated as x64 since they contain "w64" as vendor key. --- cmake/OpenCVConfig.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/OpenCVConfig.cmake b/cmake/OpenCVConfig.cmake index 5f5fa1aadb..9f3591f484 100644 --- a/cmake/OpenCVConfig.cmake +++ b/cmake/OpenCVConfig.cmake @@ -86,7 +86,7 @@ elseif(MINGW) execute_process(COMMAND ${CMAKE_CXX_COMPILER} -dumpmachine OUTPUT_VARIABLE CMAKE_OPENCV_GCC_TARGET_MACHINE OUTPUT_STRIP_TRAILING_WHITESPACE) - if(CMAKE_OPENCV_GCC_TARGET_MACHINE MATCHES "64") + if(CMAKE_OPENCV_GCC_TARGET_MACHINE MATCHES "amd64|x86_64|AMD64") set(MINGW64 1) set(OpenCV_ARCH x64) else() From d430664791a56faa707c3accbc350ede2e78f8e0 Mon Sep 17 00:00:00 2001 From: Alexander Nitsch Date: Tue, 17 Mar 2015 13:52:59 +0100 Subject: [PATCH 3/3] Remove local variables from CMAKE namespace --- cmake/OpenCVConfig.cmake | 4 ++-- cmake/OpenCVDetectCXXCompiler.cmake | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/cmake/OpenCVConfig.cmake b/cmake/OpenCVConfig.cmake index 9f3591f484..99162405a9 100644 --- a/cmake/OpenCVConfig.cmake +++ b/cmake/OpenCVConfig.cmake @@ -84,9 +84,9 @@ elseif(MINGW) set(OpenCV_RUNTIME mingw) execute_process(COMMAND ${CMAKE_CXX_COMPILER} -dumpmachine - OUTPUT_VARIABLE CMAKE_OPENCV_GCC_TARGET_MACHINE + OUTPUT_VARIABLE OPENCV_GCC_TARGET_MACHINE OUTPUT_STRIP_TRAILING_WHITESPACE) - if(CMAKE_OPENCV_GCC_TARGET_MACHINE MATCHES "amd64|x86_64|AMD64") + if(OPENCV_GCC_TARGET_MACHINE MATCHES "amd64|x86_64|AMD64") set(MINGW64 1) set(OpenCV_ARCH x64) else() diff --git a/cmake/OpenCVDetectCXXCompiler.cmake b/cmake/OpenCVDetectCXXCompiler.cmake index ddf32c5cde..a5c0fae4ab 100644 --- a/cmake/OpenCVDetectCXXCompiler.cmake +++ b/cmake/OpenCVDetectCXXCompiler.cmake @@ -91,9 +91,9 @@ elseif(CMAKE_COMPILER_IS_GNUCXX) if(WIN32) execute_process(COMMAND ${CMAKE_CXX_COMPILER} -dumpmachine - OUTPUT_VARIABLE CMAKE_OPENCV_GCC_TARGET_MACHINE + OUTPUT_VARIABLE OPENCV_GCC_TARGET_MACHINE OUTPUT_STRIP_TRAILING_WHITESPACE) - if(CMAKE_OPENCV_GCC_TARGET_MACHINE MATCHES "amd64|x86_64|AMD64") + if(OPENCV_GCC_TARGET_MACHINE MATCHES "amd64|x86_64|AMD64") set(MINGW64 1) endif() endif()