From 4a422dffaa8cbf4af2ccf8f126bc15d07bdca710 Mon Sep 17 00:00:00 2001 From: Michael Maltese Date: Fri, 27 Jan 2017 00:56:38 -0800 Subject: [PATCH] CMake: CMAKE_SIZEOF_VOID_P must be 8 for an x86_64 build This is an issue because CMAKE_SYSTEM_PROCESSOR is defined as the host processor when not cross-compiling, and building for Win32 doesn't count as cross-compiling. --- CMakeLists.txt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5b56f9a4ea..c6f4b81a10 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -166,7 +166,7 @@ if(ENABLE_GENERIC) message(STATUS "Warning! Building generic build!") set(_M_GENERIC 1) add_definitions(-D_M_GENERIC=1) -elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64|amd64|AMD64") +elseif(_ARCH_64 AND CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64|amd64|AMD64") set(_M_X86 1) set(_M_X86_64 1) add_definitions(-D_M_X86=1) @@ -180,7 +180,9 @@ elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL "aarch64") # CRC instruction set is used in the CRC32 hash function check_and_add_flag(HAVE_ARCH_ARMV8 -march=armv8-a+crc) else() - message(FATAL_ERROR "You're building on an unsupported platform '${CMAKE_SYSTEM_PROCESSOR}'. Enable generic build if you really want a JIT-less binary.") + message(FATAL_ERROR "You're building on an unsupported platform: " + "'${CMAKE_SYSTEM_PROCESSOR}' with ${CMAKE_SIZEOF_VOID_P}-byte pointers." + " Enable generic build if you really want a JIT-less binary.") endif()