Веб-сайт самохостера Lotigara

summaryrefslogtreecommitdiff
path: root/cmake
diff options
context:
space:
mode:
Diffstat (limited to 'cmake')
-rw-r--r--cmake/TargetArch.cmake22
1 files changed, 22 insertions, 0 deletions
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