From 84b8ccafe2d98b9d86597fb679ac7aa7dfb6bfd2 Mon Sep 17 00:00:00 2001
From: Benedikt Spranger <b.spranger@linutronix.de>
Date: Thu, 12 Oct 2023 19:54:39 +0200
Subject: [PATCH] cmake: fix native build on arm

uname -m on 32bit Arm platforms (little endian) report a machine string
like armv5tejl, armv7l or armv8l.

A native build on these machines fail:

CMake Error at lib/processor/CMakeLists.txt:1 (add_subdirectory):
  add_subdirectory given source "armv8l" which is not an existing directory.

Set PROJECT_PROCESSOR to arm on these machines.

Signed-off-by: Benedikt Spranger <b.spranger@linutronix.de>
---
 cmake/options.cmake | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/cmake/options.cmake b/cmake/options.cmake
index a7b4ef8b..f6b678ed 100644
--- a/cmake/options.cmake
+++ b/cmake/options.cmake
@@ -49,6 +49,11 @@ string (TOLOWER ${CMAKE_SYSTEM_PROCESSOR} PROJECT_PROCESSOR)
 if("${PROJECT_PROCESSOR}" STREQUAL "arm64")
   set (PROJECT_PROCESSOR "aarch64")
 endif()
+
+if("${PROJECT_PROCESSOR}" MATCHES "armv[4-8].*l")
+  set (PROJECT_PROCESSOR "arm")
+endif()
+
 string (TOUPPER ${PROJECT_PROCESSOR}      PROJECT_PROCESSOR_UPPER)
 string (TOLOWER ${MACHINE}                PROJECT_MACHINE)
 string (TOUPPER ${MACHINE}                PROJECT_MACHINE_UPPER)