Skip to content

Commit

Permalink
cmake: fix native build on arm
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
bene42 committed Oct 12, 2023
1 parent ddd72ec commit 84b8cca
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions cmake/options.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 84b8cca

Please sign in to comment.