From 804b1bc1972a4b5b4f359335d7a74dac65256c42 Mon Sep 17 00:00:00 2001 From: redfish Date: Tue, 21 Jun 2016 20:07:19 -0400 Subject: [PATCH] cmake: initialize ARCH for native builds We need ARCH, because it needs to be set for ARM7, ARM6 to be initialized. Strangely, on different machines (both ARMv7, Arch), ${ARCH} var is either empty or 'native'. Handle both cases. --- CMakeLists.txt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ab2c83a96..1770b229f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -45,7 +45,12 @@ function (die msg) message(FATAL_ERROR "${BoldRed}${msg}${ColourReset}") endfunction () -if (NOT ${ARCH} STREQUAL "") +if ("${ARCH}" STREQUAL "" OR "${ARCH}" STREQUAL "native") + set(ARCH ${CMAKE_SYSTEM_PROCESSOR}) + message(STATUS "Building natively on ${ARCH}") +endif() + +if (NOT "${ARCH}" STREQUAL "") string(SUBSTRING ${ARCH} 0 3 IS_ARM) string(TOLOWER ${IS_ARM} IS_ARM)