Use native CMake support for detecting architecture size

This commit is contained in:
Chris Thrasher 2023-08-15 12:58:24 -06:00
parent 5f87a04111
commit 37575e4ed7

View File

@ -5,12 +5,10 @@ if(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
# don't use the OpenGL ES implementation on Windows # don't use the OpenGL ES implementation on Windows
set(OPENGL_ES 0) set(OPENGL_ES 0)
# detect the architecture (note: this test won't work for cross-compilation) # detect the architecture
include(CheckTypeSize) if(CMAKE_SIZEOF_VOID_P EQUAL 4)
check_type_size(void* SIZEOF_VOID_PTR)
if(${SIZEOF_VOID_PTR} STREQUAL "4")
set(ARCH_32BITS 1) set(ARCH_32BITS 1)
elseif(${SIZEOF_VOID_PTR} STREQUAL "8") elseif(CMAKE_SIZEOF_VOID_P EQUAL 8)
set(ARCH_64BITS 1) set(ARCH_64BITS 1)
else() else()
message(FATAL_ERROR "Unsupported architecture") message(FATAL_ERROR "Unsupported architecture")