From 376b4f0011b9ae826c51568c23c34419887338e0 Mon Sep 17 00:00:00 2001 From: Ghislain Bourgeois Date: Thu, 26 Jan 2023 17:38:52 -0500 Subject: [PATCH] Enable specifying target architecture --- CMakeLists.txt | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c0e53cddc..61ef69737 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -95,12 +95,14 @@ option(ENABLE_ALL_TEST "Enable all unit/component test" OFF) # (gcc-ar, gcc-nm, ...). option(BUILD_WITH_LTO "Enable LTO (experimental)" OFF) -if(${CMAKE_SYSTEM_PROCESSOR} MATCHES "aarch64") - set(GCC_ARCH armv8-a CACHE STRING "GCC compile for specific architecture.") - message(STATUS "Detected aarch64 processor") -else(${CMAKE_SYSTEM_PROCESSOR} MATCHES "aarch64") - set(GCC_ARCH native CACHE STRING "GCC compile for specific architecture.") -endif(${CMAKE_SYSTEM_PROCESSOR} MATCHES "aarch64") +if(NOT GCC_ARCH) + if(${CMAKE_SYSTEM_PROCESSOR} MATCHES "aarch64") + set(GCC_ARCH armv8-a CACHE STRING "GCC compile for specific architecture.") + message(STATUS "Detected aarch64 processor") + else(${CMAKE_SYSTEM_PROCESSOR} MATCHES "aarch64") + set(GCC_ARCH native CACHE STRING "GCC compile for specific architecture.") + endif(${CMAKE_SYSTEM_PROCESSOR} MATCHES "aarch64") +endif() # On RAM constrained (embedded) systems it may be useful to limit parallel compilation with, e.g. -DPARALLEL_COMPILE_JOBS=1 if (PARALLEL_COMPILE_JOBS)