Cdroid/cmake/modules/FindPNG.cmake
2023-09-06 18:29:48 +08:00

28 lines
924 B
CMake
Executable File

find_package(PkgConfig)
pkg_check_modules(PC_PNG libpng)
find_path(PNG_INCLUDE_DIRS
NAMES png.h
HINTS ${PC_PNG_INCLUDEDIR}
${PC_PNG_INCLUDE_DIRS}
)
find_library(PNG_LIBRARIES
NAMES png
HINTS ${PC_PNG_LIBDIR}
${PC_PNG_LIBRARY_DIRS}
)
message("PC_PNG_INCLUDEDIR=${PC_PNG_INCLUDEDIR} PC_PNG_INCLUDE_DIRS=${PC_PNG_INCLUDE_DIRS} PNG_INCLUDE_DIRS=${PNG_INCLUDE_DIRS} PC_PNG_INCLUDEDIR=${PC_PNG_INCLUDEDIR}")
if(PNG_INCLUDE_DIRS AND PNG_LIBRARIES)
set(PNG_FOUND TRUE)
set(PNG_LIBRARY ${PNG_LIBRARIES})
set(PNG_INCLUDE_DIR ${PNG_INCLUDE_DIRS})
set(PNG_VERSION ${PC_PNG_VERSION})
include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(PNG FOUND_VAR PNG_FOUND VERSION_VAR PNG_VERSION
REQUIRED_VARS PNG_INCLUDE_DIRS PNG_INCLUDE_DIR PNG_LIBRARIES PNG_LIBRARY)
mark_as_advanced(PNG_LIBRARIES PNG_LIBRARY PNG_INCLUDE_DIRS PNG_INCLUDE_DIR PNG_VERSION)
endif()