From e76fc1d705fea18ad58c57241523dd8d2a72395f Mon Sep 17 00:00:00 2001 From: Ivan Davydov Date: Thu, 12 Jun 2025 16:44:02 +0300 Subject: Try to fix the 'linux unknown' text in the pause menu --- cmake/TargetArch.cmake | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'cmake') diff --git a/cmake/TargetArch.cmake b/cmake/TargetArch.cmake index 2e204fd..77e9ebb 100644 --- a/cmake/TargetArch.cmake +++ b/cmake/TargetArch.cmake @@ -65,6 +65,27 @@ function(target_architecture output_var) if(osx_arch_arm64) list(APPEND ARCH arm64) endif() + elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux" AND CMAKE_LINUX_ARCHITECTURES) + # On Linux, we use CMAKE_LINUX_ARCHITECTURES *if* it was set + + # Linux supports many architectures, but mostly used are x86_64 and arm64. + foreach(linux_arch ${CMAKE_LINUX_ARCHITECTURES}) + if("${linux_arch}" STREQUAL "x86_64") + set(linux_arch_x86_64 TRUE) + elseif("${linux_arch}" STREQUAL "arm64") + set(linux_arch_arm64 TRUE) + else() + message(FATAL_ERROR "Invalid Linux arch name: ${linux_arch}") + endif() + endforeach() + + if(linux_arch_x86_64) + list(APPEND ARCH x86_64) + endif() + + if(linux_arch_arm64) + list(APPEND ARCH arm64) + endif() else() file(WRITE "${CMAKE_BINARY_DIR}/arch.c" "${archdetect_c_code}") @@ -85,6 +106,7 @@ function(target_architecture output_var) "${CMAKE_BINARY_DIR}/arch.c" COMPILE_OUTPUT_VARIABLE ARCH CMAKE_FLAGS CMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES} + CMAKE_FLAGS CMAKE_LINUX_ARCHITECTURES=${CMAKE_LINUX_ARCHITECTURES} ) # Parse the architecture name from the compiler output -- cgit v1.2.3