summaryrefslogtreecommitdiff
path: root/png/CMakeLists.txt
diff options
context:
space:
mode:
authorAlbrecht Schlosser <albrechts.fltk@online.de>2022-02-05 21:37:37 +0100
committerAlbrecht Schlosser <albrechts.fltk@online.de>2022-02-05 21:37:37 +0100
commitaf4954aee3483f03ff69e990e80f4e4a18e8b7f6 (patch)
tree279f0c402864afa772eef520657b0c1b64605200 /png/CMakeLists.txt
parent6f09219c4384914f9fac400071d826a3841f776d (diff)
CMake/macOS: build arm files for libpng only on ARM
Remove macOS warning "ranlib: file ... has no symbols" although this works only partially (see comment in png/CMakeLists.txt).
Diffstat (limited to 'png/CMakeLists.txt')
-rw-r--r--png/CMakeLists.txt32
1 files changed, 26 insertions, 6 deletions
diff --git a/png/CMakeLists.txt b/png/CMakeLists.txt
index 117d699ee..3994dfd7b 100644
--- a/png/CMakeLists.txt
+++ b/png/CMakeLists.txt
@@ -1,7 +1,7 @@
#
# PNG library CMake configuration for the Fast Light Toolkit (FLTK).
#
-# Copyright 1998-2021 by Bill Spitzak and others.
+# Copyright 1998-2022 by Bill Spitzak and others.
#
# This library is free software. Distribution and use rights are outlined in
# the file "COPYING" which should have been included with this file. If this
@@ -31,14 +31,34 @@ set(PNG_SRCS
pngwrite.c
pngwtran.c
pngwutil.c
-
- # build on ARM (Apple M1 systems)
- arm/arm_init.c
- arm/filter_neon_intrinsics.c
- arm/palette_neon_intrinsics.c
)
#######################################################################
+# Build some files on ARM (e.g. Apple M1 systems)
+#######################################################################
+
+# We can only determine the target architecture if it is set
+# in CMAKE_OSX_ARCHITECTURES, otherwise we *assume* it is true and
+# compile these files even if this results in some warnings.
+# This includes all non-macOS platforms.
+
+if (CMAKE_OSX_ARCHITECTURES)
+ string(REGEX MATCH "arm64" is_arm "${CMAKE_OSX_ARCHITECTURES}")
+else ()
+ set (is_arm TRUE)
+endif ()
+
+if (is_arm)
+ LIST (APPEND PNG_SRCS
+ arm/arm_init.c
+ arm/filter_neon_intrinsics.c
+ arm/palette_neon_intrinsics.c
+ )
+endif ()
+
+unset (is_arm)
+
+#######################################################################
# Build the static library
#######################################################################