Warning, /plasma/kwin/cmake/modules/Findlcms2.cmake is written in an unsupported language. File is not indexed.

0001 #.rst:
0002 # Findlcms2
0003 # -------
0004 #
0005 # Try to find lcms2 on a Unix system.
0006 #
0007 # This will define the following variables:
0008 #
0009 # ``lcms2_FOUND``
0010 #     True if (the requested version of) lcms2 is available
0011 # ``lcms2_VERSION``
0012 #     The version of lcms2
0013 # ``lcms2_LIBRARIES``
0014 #     This should be passed to target_link_libraries() if the target is not
0015 #     used for linking
0016 # ``lcms2_INCLUDE_DIRS``
0017 #     This should be passed to target_include_directories() if the target is not
0018 #     used for linking
0019 # ``lcms2_DEFINITIONS``
0020 #     This should be passed to target_compile_options() if the target is not
0021 #     used for linking
0022 #
0023 # If ``lcms2_FOUND`` is TRUE, it will also define the following imported target:
0024 #
0025 # ``lcms2::lcms2``
0026 #     The lcms2 library
0027 #
0028 # In general we recommend using the imported target, as it is easier to use.
0029 # Bear in mind, however, that if the target is in the link interface of an
0030 # exported library, it must be made available by the package config file.
0031 
0032 # SPDX-FileCopyrightText: 2020 Vlad Zahorodnii <vlad.zahorodnii@kde.org>
0033 # SPDX-License-Identifier: BSD-3-Clause
0034 
0035 find_package(PkgConfig)
0036 pkg_check_modules(PKG_lcms2 QUIET lcms2)
0037 
0038 set(lcms2_VERSION ${PKG_lcms2_VERSION})
0039 set(lcms2_DEFINITIONS ${PKG_lcms2_CFLAGS_OTHER})
0040 
0041 find_path(lcms2_INCLUDE_DIR
0042     NAMES lcms2.h
0043     HINTS ${PKG_lcms2_INCLUDE_DIRS}
0044 )
0045 
0046 find_library(lcms2_LIBRARY
0047     NAMES lcms2
0048     HINTS ${PKG_lcms2_LIBRARY_DIRS}
0049 )
0050 
0051 include(FindPackageHandleStandardArgs)
0052 find_package_handle_standard_args(lcms2
0053     FOUND_VAR lcms2_FOUND
0054     REQUIRED_VARS lcms2_LIBRARY
0055                   lcms2_INCLUDE_DIR
0056     VERSION_VAR lcms2_VERSION
0057 )
0058 
0059 if (lcms2_FOUND AND NOT TARGET lcms2::lcms2)
0060     add_library(lcms2::lcms2 UNKNOWN IMPORTED)
0061     set_target_properties(lcms2::lcms2 PROPERTIES
0062         IMPORTED_LOCATION "${lcms2_LIBRARY}"
0063         INTERFACE_COMPILE_OPTIONS "${lcms2_DEFINITIONS}"
0064         # Don't use the register keyword to allow compiling in C++17 mode.
0065         # See https://github.com/mm2/Little-CMS/issues/243
0066         INTERFACE_COMPILE_DEFINITIONS "CMS_NO_REGISTER_KEYWORD=1"
0067         INTERFACE_INCLUDE_DIRECTORIES "${lcms2_INCLUDE_DIR}"
0068     )
0069 endif()
0070 
0071 set(lcms2_INCLUDE_DIRS ${lcms2_INCLUDE_DIR})
0072 set(lcms2_LIBRARIES ${lcms2_LIBRARY})
0073 
0074 mark_as_advanced(lcms2_INCLUDE_DIR)
0075 mark_as_advanced(lcms2_LIBRARY)