Skip to content

Commit 6cfa5b2

Browse files
authored
Merge pull request #743 from jdemel/fix-64bit-cpu
cmake: Fix 64bit host CPU detection
2 parents 39f0494 + 881a839 commit 6cfa5b2

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

CMakeLists.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@
1010
########################################################################
1111
# Project setup
1212
########################################################################
13-
cmake_minimum_required(VERSION 3.8)
13+
# We use `IS_64BIT now: https://cmake.org/cmake/help/latest/command/cmake_host_system_information.html
14+
cmake_minimum_required(VERSION 3.10)
15+
1416
set(CMAKE_BUILD_TYPE
1517
${CMAKE_BUILD_TYPE}
1618
CACHE STRING "Choose build type: None Debug Release RelWithDebInfo MinSizeRel")

lib/CMakeLists.txt

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -255,17 +255,16 @@ endif()
255255
########################################################################
256256
if(NOT CROSSCOMPILE_MULTILIB AND CPU_IS_x86)
257257
include(CheckTypeSize)
258-
check_type_size("void*[8]" SIZEOF_CPU BUILTIN_TYPES_ONLY)
259-
if(${SIZEOF_CPU} EQUAL 64)
258+
cmake_host_system_information(RESULT ASSUME_64BIT_HOST QUERY IS_64BIT)
259+
if(ASSUME_64BIT_HOST)
260260
overrule_arch(32 "CPU width is 64 bits")
261-
endif()
262-
if(${SIZEOF_CPU} EQUAL 32)
261+
else()
263262
overrule_arch(64 "CPU width is 32 bits")
264263
endif()
265264

266265
#MSVC 64 bit does not have MMX, overrule it
267266
if(MSVC)
268-
if(${SIZEOF_CPU} EQUAL 64)
267+
if(ASSUME_64BIT_HOST)
269268
overrule_arch(mmx "No MMX for Win64")
270269
endif()
271270
force_arch(sse "Built-in for MSVC > 2013")

0 commit comments

Comments
 (0)