#------------------------------------------------------------------- # This file is part of the CMake build system for OGRE # (Object-oriented Graphics Rendering Engine) # For the latest info, see http://www.ogre3d.org/ # # The contents of this file are placed in the public domain. Feel # free to make use of it in any way you like. #------------------------------------------------------------------- # - Try to find PNG # Once done, this will define # # PNG_FOUND - system has PNG # PNG_INCLUDE_DIRS - the PNG include directories # PNG_LIBRARIES - link these to use PNG include(FindPkgMacros) findpkg_begin(PNG) # Get path, convert backslashes as ${ENV_${var}} getenv_path(PNG_HOME) # construct search paths set(PNG_PREFIX_PATH ${PNG_HOME} ${ENV_PNG_HOME} ) create_search_paths(PNG) # redo search if prefix path changed clear_if_changed(PNG_PREFIX_PATH PNG_LIBRARY_FWK PNG_LIBRARY_REL PNG_LIBRARY_DBG PNG_LIBRARY_RELEASE PNG_LIBRARY_DEBUG PNG_INCLUDE_DIR ) set(PNG_LIBRARY_NAMES libpng16_static png16_static PNG png libpng) get_debug_names(PNG_LIBRARY_NAMES) findpkg_framework(PNG) find_path(PNG_INCLUDE_DIR NAMES png.h HINTS ${PNG_INC_SEARCH_PATH} ${PNG_PKGC_INCLUDE_DIRS} NO_CMAKE_FIND_ROOT_PATH) find_library(PNG_LIBRARY_REL NAMES ${PNG_LIBRARY_NAMES} HINTS ${PNG_LIB_SEARCH_PATH} ${PNG_PKGC_LIBRARY_DIRS} PATH_SUFFIXES "" Release RelWithDebInfo MinSizeRel ${ANDROID_ABI} NO_CMAKE_FIND_ROOT_PATH) find_library(PNG_LIBRARY_DBG NAMES ${PNG_LIBRARY_NAMES_DBG} HINTS ${PNG_LIB_SEARCH_PATH} ${PNG_PKGC_LIBRARY_DIRS} PATH_SUFFIXES "" Debug ${ANDROID_ABI} NO_CMAKE_FIND_ROOT_PATH) set(PNG_LIBRARY_RELEASE ${PNG_LIBRARY_REL}) set(PNG_LIBRARY_DEBUG ${PNG_LIBRARY_DBG}) make_library_set(PNG_LIBRARY) findpkg_finish(PNG) if(PNG_FOUND) if(NOT TARGET PNG::PNG) add_library(PNG::PNG UNKNOWN IMPORTED) if(PNG_INCLUDE_DIRS) set_target_properties(PNG::PNG PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${PNG_INCLUDE_DIRS}") endif() if(EXISTS "${PNG_LIBRARY}") set_target_properties(PNG::PNG PROPERTIES IMPORTED_LINK_INTERFACE_LANGUAGES "C" IMPORTED_LOCATION "${PNG_LIBRARY}") endif() if(EXISTS "${PNG_LIBRARY_RELEASE}") set_property(TARGET PNG::PNG APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE) set_target_properties(PNG::PNG PROPERTIES IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "C" IMPORTED_LOCATION_RELEASE "${PNG_LIBRARY_RELEASE}") endif() if(EXISTS "${PNG_LIBRARY_DEBUG}") set_property(TARGET PNG::PNG APPEND PROPERTY IMPORTED_CONFIGURATIONS DEBUG) set_target_properties(PNG::PNG PROPERTIES IMPORTED_LINK_INTERFACE_LANGUAGES_DEBUG "C" IMPORTED_LOCATION_DEBUG "${PNG_LIBRARY_DEBUG}") endif() endif() endif()