From ae7dec2dd7e6e4795daff9e706bb27d2f1dd3595 Mon Sep 17 00:00:00 2001 From: Nicklas Larsson Date: Wed, 6 May 2026 09:16:42 +0200 Subject: [PATCH] cmake: set BUILD_ARCH with CMAKE_HOST_SYSTEM_PROCESSOR Remove custom function 'get_host_arch'. --- CMakeLists.txt | 3 +-- cmake/modules/get_host_arch.cmake | 44 ------------------------------- 2 files changed, 1 insertion(+), 46 deletions(-) delete mode 100644 cmake/modules/get_host_arch.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index 62d49823b47..df896e8dd7a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -154,8 +154,7 @@ option(WITH_FHS "Install with FHS" OFF) include(check_target) include(CheckDependentLibraries) -include(get_host_arch) -get_host_arch(BUILD_ARCH) +set(BUILD_ARCH ${CMAKE_HOST_SYSTEM_PROCESSOR}) # Setup GRASS install directories include(GRASSInstallDirs) diff --git a/cmake/modules/get_host_arch.cmake b/cmake/modules/get_host_arch.cmake deleted file mode 100644 index ff12c2539f8..00000000000 --- a/cmake/modules/get_host_arch.cmake +++ /dev/null @@ -1,44 +0,0 @@ -#[[ -AUTHOR(S): Rashad Kanavath -PURPOSE: Get host system architecture -COPYRIGHT: (C) 2020 by the GRASS Development Team - -SPDX-License-Identifier: GPL-2.0-or-later -#]] - -function(get_host_arch var_arch) - set(host_arch_value "x86_64") # default value - - if(WIN32) - if(MSVC) - execute_process( - COMMAND ${CMAKE_C_COMPILER} - ERROR_VARIABLE ev - OUTPUT_VARIABLE ov - OUTPUT_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE) - - if("${ev}" MATCHES "x86") - set(${host_arch_value} "x86") - else() - set(${host_arch_value} "x86_64") - endif() - - elseif(MINGW) - - else() - message(FATAL_ERROR "compiler/platform is not supported") - endif() # if(MSVC) - - elseif(UNIX) - execute_process( - COMMAND uname -m - ERROR_VARIABLE ev - OUTPUT_VARIABLE ov - OUTPUT_STRIP_TRAILING_WHITESPACE) - set(${host_arch_value} "${ov}") - endif() - - set(${var_arch} - ${host_arch_value} - PARENT_SCOPE) -endfunction()