#------------------------------------------------------------------- # 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 ZLIB # Once done, this will define # # ZLIB_FOUND - system has ZLIB # ZLIB_INCLUDE_DIRS - the ZLIB include directories # ZLIB_LIBRARIES - link these to use ZLIB include(FindPkgMacros) findpkg_begin(ZLIB) # Get path, convert backslashes as ${ENV_${var}} #getenv_path(ZLIB_HOME) # construct search paths # set(ZLIB_PREFIX_PATH ${ZLIB_HOME} ${ENV_ZLIB_HOME} ) create_search_paths(ZLIB) # redo search if prefix path changed clear_if_changed(ZLIB_PREFIX_PATH ZLIB_LIBRARY_FWK ZLIB_LIBRARY_RELEASE ZLIB_LIBRARY_DEBUG ZLIB_INCLUDE_DIR ) set(ZLIB_LIBRARY_NAMES zlibstatic libz z zlib zdll) get_debug_names(ZLIB_LIBRARY_NAMES) #use_pkgconfig(ZLIB_PKGC zzip-zlib-config) #findpkg_framework(ZLIB) if (APPLE) find_path(ZLIB_INCLUDE_DIR NAMES zlib.h HINTS ${ZLIB_INC_SEARCH_PATH} ${ZLIB_PKGC_INCLUDE_DIRS} NO_CMAKE_FIND_ROOT_PATH) else(APPLE) find_path(ZLIB_INCLUDE_DIR NAMES zlib.h HINTS ${ZLIB_INC_SEARCH_PATH} ${ZLIB_PKGC_INCLUDE_DIRS}) endif(APPLE) find_library(ZLIB_LIBRARY_RELEASE NAMES ${ZLIB_LIBRARY_NAMES} HINTS ${ZLIB_LIB_SEARCH_PATH} ${ZLIB_PKGC_LIBRARY_DIRS} PATH_SUFFIXES "" Release RelWithDebInfo MinSizeRel ${ANDROID_ABI}) find_library(ZLIB_LIBRARY_DEBUG NAMES ${ZLIB_LIBRARY_NAMES_DBG} HINTS ${ZLIB_LIB_SEARCH_PATH} ${ZLIB_PKGC_LIBRARY_DIRS} PATH_SUFFIXES "" Debug ${ANDROID_ABI}) make_library_set(ZLIB_LIBRARY) findpkg_finish(ZLIB) if(ZLIB_FOUND) if(NOT TARGET ZLIB::ZLIB) add_library(ZLIB::ZLIB UNKNOWN IMPORTED) if(ZLIB_INCLUDE_DIRS) set_target_properties(ZLIB::ZLIB PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${ZLIB_INCLUDE_DIRS}") endif() if(EXISTS "${ZLIB_LIBRARY}") set_target_properties(ZLIB::ZLIB PROPERTIES IMPORTED_LINK_INTERFACE_LANGUAGES "C" IMPORTED_LOCATION "${ZLIB_LIBRARY}") endif() if(EXISTS "${ZLIB_LIBRARY_RELEASE}") set_property(TARGET ZLIB::ZLIB APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE) set_target_properties(ZLIB::ZLIB PROPERTIES IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "C" IMPORTED_LOCATION_RELEASE "${ZLIB_LIBRARY_RELEASE}") endif() if(EXISTS "${ZLIB_LIBRARY_DEBUG}") set_property(TARGET ZLIB::ZLIB APPEND PROPERTY IMPORTED_CONFIGURATIONS DEBUG) set_target_properties(ZLIB::ZLIB PROPERTIES IMPORTED_LINK_INTERFACE_LANGUAGES_DEBUG "C" IMPORTED_LOCATION_DEBUG "${ZLIB_LIBRARY_DEBUG}") endif() endif() endif() # We don't want an absolute path on Apple systems to avoid link failures when switching SDK at build time. if (ANDROID AND ZLIB_FOUND) set(ZLIB_LIBRARIES "z") set(ZLIB_LIBRARY ${ZLIB_LIBRARIES}) endif()