build: Update the CMake build options PNG_TOOLS and PNG_FRAMEWORK

Update the PNG_TOOLS option: set it to OFF by default when the
target is an embedded system, yet still allow it to be overridden.

Update the PNG_FRAMEWORK option: force it back to OFF and print a
warning if the option was ON but the target is not an Apple system.
This commit is contained in:
Cosmin Truta 2024-02-19 14:25:55 +02:00
parent e7ba9c0dfc
commit aa95dee697

View File

@ -62,9 +62,18 @@ if(APPLE)
endif() endif()
# Allow the users to switch on/off the auxiliary build and test artifacts. # Allow the users to switch on/off the auxiliary build and test artifacts.
# NOTE: These artifacts are NOT part of libpng proper, and are subject to change at any time. # These artifacts are NOT part of libpng proper, and are subject to change
# at any time.
option(PNG_TESTS "Build the libpng tests" ON) option(PNG_TESTS "Build the libpng tests" ON)
# Same as above, but for the third-party tools.
# Although these tools are targetted at development environments only,
# the users are allowed to override the option to build by default.
if (ANDROID OR IOS)
option(PNG_TOOLS "Build the libpng tools" OFF)
else()
option(PNG_TOOLS "Build the libpng tools" ON) option(PNG_TOOLS "Build the libpng tools" ON)
endif()
# Maintain backwards compatibility with the deprecated option PNG_EXECUTABLES. # Maintain backwards compatibility with the deprecated option PNG_EXECUTABLES.
option(PNG_EXECUTABLES "[Deprecated; please use PNG_TOOLS]" ON) option(PNG_EXECUTABLES "[Deprecated; please use PNG_TOOLS]" ON)
@ -719,7 +728,13 @@ if(PNG_STATIC)
target_link_libraries(png_static PUBLIC ZLIB::ZLIB ${M_LIBRARY}) target_link_libraries(png_static PUBLIC ZLIB::ZLIB ${M_LIBRARY})
endif() endif()
if(PNG_FRAMEWORK AND APPLE) if(PNG_FRAMEWORK AND NOT APPLE)
message(AUTHOR_WARNING
"Setting PNG_FRAMEWORK to OFF, as it only applies to Apple systems")
set(PNG_FRAMEWORK OFF)
endif()
if(PNG_FRAMEWORK)
add_library(png_framework SHARED ${libpng_sources}) add_library(png_framework SHARED ${libpng_sources})
add_dependencies(png_framework png_genfiles) add_dependencies(png_framework png_genfiles)
list(APPEND PNG_LIBRARY_TARGETS png_framework) list(APPEND PNG_LIBRARY_TARGETS png_framework)