From fe006897572de0fa9a9efc1d5937837d110f4da8 Mon Sep 17 00:00:00 2001 From: Alexander Alekhin Date: Tue, 6 Oct 2015 20:42:21 +0300 Subject: [PATCH] workaround for 32-bit OS on 64-bit x86 CPU --- cmake/OpenCVDetectCXXCompiler.cmake | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/cmake/OpenCVDetectCXXCompiler.cmake b/cmake/OpenCVDetectCXXCompiler.cmake index 360a08fec1..bd3cf49d02 100644 --- a/cmake/OpenCVDetectCXXCompiler.cmake +++ b/cmake/OpenCVDetectCXXCompiler.cmake @@ -116,6 +116,12 @@ elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(aarch64.*|AARCH64.*)") set(AARCH64 1) endif() +# Workaround for 32-bit operating systems on 64-bit x86_64 processor +if(X86_64 AND CMAKE_SIZEOF_VOID_P EQUAL 4 AND NOT FORCE_X86_64) + message(STATUS "sizeof(void) = 4 on x86 / x86_64 processor. Assume 32-bit compilation mode (X86=1)") + unset(X86_64) + set(X86 1) +endif() # Similar code exists in OpenCVConfig.cmake if(NOT DEFINED OpenCV_STATIC)