Fix CPU architecture detection on BSDs.

CMake calls "uname" in order to detect the CPU architecture,
so $(CMAKE_SYSTEM_PROCESSOR) varies from platform to platform.

This changes adds support for "i386" and "amd64" values, which
are used by BSDs for the x86 family of CPUs.

Change-Id: I532ce787a9ac06220c92a6d8c78ad5a55d8c40bf
Signed-off-by: Piotr Sikora <piotr@cloudflare.com>
Reviewed-on: https://boringssl-review.googlesource.com/1360
Reviewed-by: Adam Langley <agl@google.com>
This commit is contained in:
Piotr Sikora 2014-07-31 03:09:49 -07:00 committed by Adam Langley
parent ad1907fe73
commit 1d8adf18d2

View File

@ -12,6 +12,8 @@ endif()
if (${CMAKE_SYSTEM_PROCESSOR} STREQUAL "x86_64") if (${CMAKE_SYSTEM_PROCESSOR} STREQUAL "x86_64")
set(ARCH "x86_64") set(ARCH "x86_64")
elseif (${CMAKE_SYSTEM_PROCESSOR} STREQUAL "amd64")
set(ARCH "x86_64")
elseif (${CMAKE_SYSTEM_PROCESSOR} STREQUAL "AMD64") elseif (${CMAKE_SYSTEM_PROCESSOR} STREQUAL "AMD64")
# cmake reports AMD64 on Windows, but we might be building for 32-bit. # cmake reports AMD64 on Windows, but we might be building for 32-bit.
if (CMAKE_CL_64) if (CMAKE_CL_64)
@ -21,6 +23,8 @@ elseif (${CMAKE_SYSTEM_PROCESSOR} STREQUAL "AMD64")
endif() endif()
elseif (${CMAKE_SYSTEM_PROCESSOR} STREQUAL "x86") elseif (${CMAKE_SYSTEM_PROCESSOR} STREQUAL "x86")
set(ARCH "x86") set(ARCH "x86")
elseif (${CMAKE_SYSTEM_PROCESSOR} STREQUAL "i386")
set(ARCH "x86")
elseif (${CMAKE_SYSTEM_PROCESSOR} STREQUAL "arm") elseif (${CMAKE_SYSTEM_PROCESSOR} STREQUAL "arm")
set(ARCH "arm") set(ARCH "arm")
else() else()