[PATCH] cmake: Default to PNG_ARM_NEON=off for arm targets

Martin Storsjö <[email protected]> Wed, 12 Oct 2022 10:30:29 +0300
Newsgroups gmane.comp.graphics.png.devel
Message-ID <[email protected]>
This matches the configure script - unless the user has requested
anything, no hardware optimizations are autoenabled.

Defaulting to "check" is brittle (that configuration is deprecated
and poorly supported) - and for configurations where it would
make sense (where NEON isn't universally enabled in the compiler)
it didn't end up setting ARM_NEON_OPT to 1 in pnglibconf.h anyway.

This fixes default builds with cmake for iOS and Windows on armv7,
where NEON is universally available (but there's no runtime check
implemented) - but actually using NEON on this architecture
requires explicitly opting in to it when configuring, just like
with the configure script.
---
 CMakeLists.txt | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4662a50a7..4f31d92f7 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -98,8 +98,8 @@ if(TARGET_ARCH MATCHES "^arm" OR
         CACHE STRING "Enable ARM NEON optimizations: on|off; on is default")
   else()
     set(PNG_ARM_NEON_POSSIBLE_VALUES check on off)
-    set(PNG_ARM_NEON "check"
-        CACHE STRING "Enable ARM NEON optimizations: check|on|off; check is default")
+    set(PNG_ARM_NEON "off"
+        CACHE STRING "Enable ARM NEON optimizations: check|on|off; off is default")
   endif()
   set_property(CACHE PNG_ARM_NEON
                PROPERTY STRINGS ${PNG_ARM_NEON_POSSIBLE_VALUES})
-- 
2.37.0 (Apple Git-136)