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

0001 # - Find LCMS2
0002 # Find the LCMS2 includes and library
0003 #
0004 # This module defines
0005 #
0006 #  LCMS2_INCLUDE_DIR, where to find lcms.h
0007 #  LCMS2_LIBRARIES, the libraries needed to use LCMS2.
0008 #  LCMS2_VERSION, The value of LCMS_VERSION defined in lcms.h
0009 #  LCMS2_FOUND, If false, do not try to use LCMS2.
0010 #
0011 # SPDX-FileCopyrightText: 2008 by Adrian Page, <adrian@pagenet.plus.com>
0012 # SPDX-FileCopyrightText: 2009 by Cyrille Berger, <cberger@cberger.net>
0013 #
0014 # SPDX-License-Identifier: BSD-3-Clause
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(NOT WIN32)
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(LCMS2_INCLUDE_DIR AND LCMS2_LIBRARIES)
0042    set(LCMS2_FOUND FALSE)
0043 endif(LCMS2_INCLUDE_DIR AND LCMS2_LIBRARIES)
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(NOT LCMS2_FIND_QUIETLY)
0055    else(LCMS2_VERSION_MATCH)
0056       if(NOT LCMS2_FIND_QUIETLY)
0057          message(STATUS "Found lcms2 but failed to find version ${LCMS2_LIBRARIES}")
0058       endif(NOT LCMS2_FIND_QUIETLY)
0059       set(LCMS2_VERSION NOTFOUND)
0060    endif(LCMS2_VERSION_MATCH)
0061 else(LCMS2_FOUND)
0062    if(NOT LCMS2_FIND_QUIETLY)
0063       if(LCMS2_FIND_REQUIRED)
0064          message(FATAL_ERROR "Required package lcms2 NOT found")
0065       else(LCMS2_FIND_REQUIRED)
0066          message(STATUS "lcms2 NOT found")
0067       endif(LCMS2_FIND_REQUIRED)
0068    endif(NOT LCMS2_FIND_QUIETLY)
0069 endif(LCMS2_FOUND)
0070 
0071 mark_as_advanced(LCMS2_INCLUDE_DIR LCMS2_LIBRARIES LCMS2_VERSION)
0072