mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-18 05:58:19 +00:00
65ad57a448
This is desirable mainly because libpng is maintained and pnglite is not. pnglite was last updated in 2007 (15 years ago) and probably has a lot of security vulnerabilities. libpng is an actively maintained library also used by browsers like Firefox or Chromium, so it's less likely to contain security vulnerabilities, also it's more likely to be packaged by Linux distributions.
47 lines
1.3 KiB
CMake
47 lines
1.3 KiB
CMake
if(NOT PREFER_BUNDLED_LIBS)
|
|
set(CMAKE_MODULE_PATH ${ORIGINAL_CMAKE_MODULE_PATH})
|
|
find_package(PNG)
|
|
set(CMAKE_MODULE_PATH ${OWN_CMAKE_MODULE_PATH})
|
|
if(PNG_FOUND)
|
|
set(PNG_BUNDLED OFF)
|
|
set(PNG_DEP)
|
|
endif()
|
|
endif()
|
|
|
|
if(NOT PNG_FOUND)
|
|
set_extra_dirs_lib(PNG png)
|
|
find_library(PNG_LIBRARY
|
|
NAMES png16 libpng16 libpng16-16 png16-16
|
|
HINTS ${HINTS_PNG_LIBDIR} ${PC_PNG_LIBDIR} ${PC_PNG_LIBRARY_DIRS}
|
|
PATHS ${PATHS_PNG_LIBDIR}
|
|
${CROSSCOMPILING_NO_CMAKE_SYSTEM_PATH}
|
|
)
|
|
|
|
set_extra_dirs_include(PNG png "${PNG_LIBRARY}")
|
|
find_path(PNG_INCLUDEDIR
|
|
NAMES png.h
|
|
HINTS ${HINTS_PNG_INCLUDEDIR} ${PC_PNG_INCLUDEDIR} ${PC_PNG_INCLUDE_DIRS}
|
|
PATHS ${PATHS_PNG_INCLUDEDIR}
|
|
${CROSSCOMPILING_NO_CMAKE_SYSTEM_PATH}
|
|
)
|
|
|
|
mark_as_advanced(PNG_LIBRARY PNG_INCLUDEDIR)
|
|
|
|
if(PNG_LIBRARY AND PNG_INCLUDEDIR)
|
|
include(FindPackageHandleStandardArgs)
|
|
find_package_handle_standard_args(PNG DEFAULT_MSG PNG_LIBRARY PNG_INCLUDEDIR)
|
|
|
|
set(PNG_LIBRARIES ${PNG_LIBRARY})
|
|
set(PNG_INCLUDE_DIRS ${PNG_INCLUDEDIR})
|
|
endif()
|
|
endif()
|
|
|
|
if(PNG_FOUND)
|
|
is_bundled(PNG_BUNDLED "${PNG_LIBRARY}")
|
|
if(PNG_BUNDLED AND TARGET_OS STREQUAL "windows")
|
|
set(PNG_COPY_FILES "${EXTRA_PNG_LIBDIR}/libpng16-16.dll")
|
|
else()
|
|
set(PNG_COPY_FILES)
|
|
endif()
|
|
endif()
|