Warning, /graphics/gwenview/cmake/FindLCMS2.cmake is written in an unsupported language. File is not indexed.

0001 # - Find LCMS2
0002 # Find the LCMS2 includes and library
0003 # This module defines
0004 #  LCMS2_INCLUDE_DIR, where to find lcms.h
0005 #  LCMS2_LIBRARIES, the libraries needed to use LCMS2.
0006 #  LCMS2_VERSION, The value of LCMS_VERSION defined in lcms.h
0007 #  LCMS2_FOUND, If false, do not try to use LCMS2.
0008 
0009 
0010 # Copyright (c) 2008, Adrian Page, <adrian@pagenet.plus.com>
0011 # Copyright (c) 2009, Cyrille Berger, <cberger@cberger.net>
0012 #
0013 # Redistribution and use is allowed according to the terms of the BSD license.
0014 # For details see the accompanying COPYING-CMAKE-SCRIPTS file.
0015 
0016 
0017 # use pkg-config to get the directories and then use these values
0018 # in the FIND_PATH() and FIND_LIBRARY() calls
0019 if(NOT WIN32)
0020    find_package(PkgConfig)
0021    pkg_check_modules(PC_LCMS2 lcms2)
0022    set(LCMS2_DEFINITIONS ${PC_LCMS2_CFLAGS_OTHER})
0023 endif()
0024 
0025 find_path(LCMS2_INCLUDE_DIR lcms2.h
0026    PATHS
0027    ${PC_LCMS2_INCLUDEDIR}
0028    ${PC_LCMS2_INCLUDE_DIRS}
0029    PATH_SUFFIXES lcms2 liblcms2
0030 )
0031 
0032 find_library(LCMS2_LIBRARIES NAMES lcms2 liblcms2 lcms-2 liblcms-2
0033    PATHS
0034    ${PC_LCMS2_LIBDIR}
0035    ${PC_LCMS2_LIBRARY_DIRS}
0036    PATH_SUFFIXES lcms2
0037 )
0038 
0039 if(LCMS2_INCLUDE_DIR AND LCMS2_LIBRARIES)
0040    set(LCMS2_FOUND TRUE)
0041 else()
0042    set(LCMS2_FOUND FALSE)
0043 endif()
0044 
0045 if(LCMS2_FOUND)
0046    file(READ ${LCMS2_INCLUDE_DIR}/lcms2.h LCMS2_VERSION_CONTENT)
0047    string(REGEX MATCH "#define LCMS_VERSION[ ]*[0-9]*\n" LCMS2_VERSION_MATCH ${LCMS2_VERSION_CONTENT})
0048    if(LCMS2_VERSION_MATCH)
0049       string(REGEX REPLACE "#define LCMS_VERSION[ ]*([0-9]*)\n" "\\1" LCMS2_VERSION ${LCMS2_VERSION_MATCH})
0050       if(NOT LCMS2_FIND_QUIETLY)
0051          string(SUBSTRING ${LCMS2_VERSION} 0 1 LCMS2_MAJOR_VERSION)
0052          string(SUBSTRING ${LCMS2_VERSION} 1 2 LCMS2_MINOR_VERSION)
0053          message(STATUS "Found lcms version ${LCMS2_MAJOR_VERSION}.${LCMS2_MINOR_VERSION}, ${LCMS2_LIBRARIES}")
0054       endif()
0055    else()
0056       if(NOT LCMS2_FIND_QUIETLY)
0057          message(STATUS "Found lcms2 but failed to find version ${LCMS2_LIBRARIES}")
0058       endif()
0059       set(LCMS2_VERSION NOTFOUND)
0060    endif()
0061 else()
0062    if(NOT LCMS2_FIND_QUIETLY)
0063       if(LCMS2_FIND_REQUIRED)
0064          message(FATAL_ERROR "Required package lcms2 NOT found")
0065       else()
0066          message(STATUS "lcms2 NOT found")
0067       endif()
0068    endif()
0069 endif()
0070 
0071 mark_as_advanced(LCMS2_INCLUDE_DIR LCMS2_LIBRARIES LCMS2_VERSION)