From 0f4db23fe026ba3c63c0de58f483175d3323ae8b Mon Sep 17 00:00:00 2001 From: dcvz Date: Wed, 22 May 2024 00:52:49 +0200 Subject: [PATCH] Allow overriding via cmd --- CMakeLists.txt | 2 -- cmake/ZREDetectNEON.cmake | 12 ++++++++---- cmake/ZREDetectSSE42.cmake | 12 ++++++++---- 3 files changed, 16 insertions(+), 10 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b4530e7..756f505 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -26,9 +26,7 @@ endif() # Check CPU requirements include(cmake/ZREDetectSSE42.cmake) -message(STATUS "SUPPORTS_SSE4.2 = ${SUPPORTS_SSE42}") include(cmake/ZREDetectNEON.cmake) -message(STATUS "SUPPORTS_NEON = ${SUPPORTS_NEON}") if(CMAKE_SIZEOF_VOID_P EQUAL 8 AND CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64|amd64|AMD64" AND NOT SUPPORTS_AVX) message(FATAL_ERROR "FATAL: A CPU supporting SSE4.2 is required.") diff --git a/cmake/ZREDetectNEON.cmake b/cmake/ZREDetectNEON.cmake index 56a1c1a..7e6de46 100644 --- a/cmake/ZREDetectNEON.cmake +++ b/cmake/ZREDetectNEON.cmake @@ -1,4 +1,8 @@ -try_compile(SUPPORTS_NEON - "${CMAKE_BINARY_DIR}" - "${CMAKE_SOURCE_DIR}/cmake/checks/cpu_neon.cpp" -) \ No newline at end of file +if(NOT DEFINED SUPPORTS_NEON) + try_compile(SUPPORTS_NEON + "${CMAKE_BINARY_DIR}" + "${CMAKE_SOURCE_DIR}/cmake/checks/cpu_neon.cpp" + ) +endif() + +message(STATUS "SUPPORTS NEON: ${SUPPORTS_NEON}") diff --git a/cmake/ZREDetectSSE42.cmake b/cmake/ZREDetectSSE42.cmake index ab96e95..8e8ba73 100644 --- a/cmake/ZREDetectSSE42.cmake +++ b/cmake/ZREDetectSSE42.cmake @@ -1,4 +1,8 @@ -try_compile(SUPPORTS_SSE42 - "${CMAKE_BINARY_DIR}" - "${CMAKE_SOURCE_DIR}/cmake/checks/cpu_sse42.cpp" -) \ No newline at end of file +if(NOT DEFINED SUPPORTS_SSE42) + try_compile(SUPPORTS_SSE42 + "${CMAKE_BINARY_DIR}" + "${CMAKE_SOURCE_DIR}/cmake/checks/cpu_sse42.cpp" + ) +endif() + +message(STATUS "SUPPORTS SSE4.2 = ${SUPPORTS_SSE42}")