Warning, /graphics/kuickshow/cmake/modules/FindIMLIB.cmake is written in an unsupported language. File is not indexed.

0001 # Copyright (c) 2006, Dirk Mueller, <mueller@kde.org>
0002 # Copyright (c) 2017, Christian Gerloff <chrgerloff@gmx.net>
0003 #
0004 # Redistribution and use is allowed according to the terms of the BSD license.
0005 # For details see the accompanying COPYING-CMAKE-SCRIPTS file.
0006 
0007 
0008 # FindIMLIB
0009 # ---------
0010 #
0011 # Find the Imlib graphics library.
0012 #
0013 # Result variables
0014 # ^^^^^^^^^^^^^^^^
0015 #
0016 # This module will set the following variables in your project:
0017 #
0018 # IMLIB_FOUND (boolean)
0019 #     Is true if the library has been found, otherwise false.
0020 # IMLIB_DEFINITIONS
0021 #     The compiler flags required to use the library.
0022 #     Use them with target_compile_definitions(<target> <scope> ${IMLIB_DEFINITIONS})
0023 # IMLIB_INCLUDE_DIRS
0024 #     The directories where the include files are located.
0025 #     Use them with target_include_directories(<target> <scope> ${IMLIB_INCLUDE_DIRS})
0026 # IMLIB_LIBRARIES
0027 #     The required libraries to link against.
0028 #     Use them with target_link_libraries(<target> <scope> ${IMLIB_LIBRARIES})
0029 #
0030 # libImlib_*
0031 #     These variables are INTERNAL to this cmake module.
0032 #     You should not depend on their values (or even existence) outside this file.
0033 
0034 
0035 # check if we've already tried to find the library
0036 if (NOT "${IMLIB_CACHED}" STREQUAL "")
0037         if ("${IMLIB_CACHED}" STREQUAL "YES")
0038                 set(IMLIB_FOUND true)
0039         endif()
0040 else()
0041         # first, try to use imlib's pkg-config to get the flags, paths and libs
0042         include(FindPkgConfig OPTIONAL RESULT_VARIABLE _fpc)
0043         if(NOT "${_fpc}" STREQUAL "NOTFOUND")
0044                 pkg_check_modules(libImlib imlib>=1.9)
0045         endif()
0046         unset(_fpc)
0047 
0048         # if that failed, try a manual approach (last resort)
0049         if (NOT libImlib_FOUND)
0050                 find_path(libImlib_INCLUDEDIR Imlib.h)
0051                 find_library(libImlib_LIBRARIES NAMES Imlib libImlib)
0052 
0053                 # how do we get this with find_library(...) ? (for now, make sure it's empty)
0054                 set(libImlib_LIBDIR "")
0055 
0056                 if (libImlib_INCLUDEDIR AND libImlib_LIBRARIES)
0057                         set(libImlib_FOUND true)
0058                 endif()
0059         endif()
0060 
0061 
0062         # next, set the exported variables
0063         if (libImlib_FOUND)
0064                 # the list of libraries must include the library paths
0065                 set(_libs "")
0066                 foreach(libdir ${libImlib_LIBDIR})
0067                         list(APPEND _libs "-L${libdir}")
0068                 endforeach()
0069                 list(APPEND _libs ${libImlib_LIBRARIES})
0070 
0071                 # the exported variables need to be cached
0072                 set(_CACHED "YES")
0073                 set(IMLIB_FOUND true)
0074                 set(IMLIB_INCLUDE_DIRS "${libImlib_INCLUDEDIR}" CACHE PATH "Include path for Imlib.h")
0075                 set(IMLIB_DEFINITIONS "${libImlib_CFLAGS}" CACHE STRING "Compiler definitions for imlib")
0076                 set(IMLIB_LIBRARIES "${_libs}" CACHE STRING "Libraries for imlib")
0077                 unset(_libs)
0078 
0079                 if (NOT IMLIB_FIND_QUIETLY)
0080                         message(STATUS "Found IMLIB Defs     : ${IMLIB_DEFINITIONS}")
0081                         message(STATUS "Found IMLIB Includes : ${IMLIB_INCLUDE_DIRS}")
0082                         message(STATUS "Found IMLIB Libraries: ${IMLIB_LIBRARIES}")
0083                 endif()
0084 
0085                 mark_as_advanced(IMLIB_DEFINITIONS IMLIB_INCLUDE_DIRS IMLIB_LIBRARIES)
0086         else()
0087                 # (optionally) display error and (optionally) fail
0088                 set(_CACHED "NO")
0089                 if (IMLIB_FIND_REQUIRED)
0090                         message(FATAL_ERROR "Could NOT find IMLIB")
0091                 elseif (NOT IMLIB_FIND_QUIETLY)
0092                         message(STATUS "Didn't find IMLIB")
0093                 endif()
0094         endif()
0095 
0096         set(IMLIB_CACHED ${_CACHED} CACHE INTERNAL "If imlib has been found")
0097         unset(_CACHED)
0098 endif()