Warning, /graphics/krita/cmake/modules/FindRaqm.cmake is written in an unsupported language. File is not indexed.
0001 # SPDX-FileCopyrightText: 2022 L. E. Segovia <amy@amyspark.me>
0002 # SPDX-License-Identifier: BSD-3-Clause
0003
0004 #[=======================================================================[.rst:
0005 FindRaqm
0006 --------------
0007
0008 Find Raqm headers and libraries.
0009
0010 Imported Targets
0011 ^^^^^^^^^^^^^^^^
0012
0013 ``Raqm::Raqm``
0014 The Raqm library, if found.
0015
0016 Result Variables
0017 ^^^^^^^^^^^^^^^^
0018
0019 This will define the following variables in your project:
0020
0021 ``Raqm_FOUND``
0022 true if (the requested version of) Raqm is available.
0023 ``Raqm_VERSION``
0024 the version of Raqm.
0025 ``Raqm_LIBRARIES``
0026 the libraries to link against to use Raqm.
0027 ``Raqm_INCLUDE_DIRS``
0028 where to find the Raqm headers.
0029 ``Raqm_COMPILE_OPTIONS``
0030 this should be passed to target_compile_options(), if the
0031 target is not used for linking
0032
0033 #]=======================================================================]
0034
0035 include(FindPackageHandleStandardArgs)
0036
0037 find_package(PkgConfig QUIET)
0038
0039 if (PkgConfig_FOUND)
0040 pkg_check_modules(PC_RAQM QUIET raqm)
0041 set(Raqm_VERSION ${PC_RAQM_VERSION})
0042 set(Raqm_COMPILE_OPTIONS "${PC_RAQM_CFLAGS} ${PC_RAQM_CFLAGS_OTHER}")
0043 endif ()
0044
0045 find_path(Raqm_INCLUDE_DIR
0046 NAMES raqm.h
0047 HINTS ${PC_RAQM_INCLUDEDIR} ${PC_RAQM_INCLUDE_DIRS}
0048 )
0049
0050 find_library(Raqm_LIBRARY
0051 NAMES ${Raqm_NAMES} raqm
0052 HINTS ${PC_RAQM_LIBDIR} ${PC_RAQM_LIBRARY_DIRS}
0053 )
0054
0055 if (NOT Raqm_VERSION AND Raqm_INCLUDE_DIR)
0056 file(READ ${Raqm_INCLUDE_DIR}/raqm-version.h _raqm_version_content)
0057
0058 string(REGEX MATCH "#define RAQM_VERSION_STRING[ \t]+\"([0-9.]+)\"\n" _version_match ${_raqm_version_content})
0059
0060 if (_version_match)
0061 set(Raqm_VERSION "${CMAKE_MATCH_1}")
0062 else()
0063 if(NOT Raqm_FIND_QUIETLY)
0064 message(WARNING "Failed to get version information from ${Raqm_INCLUDE_DIR}/raqm-version.h")
0065 endif()
0066 endif()
0067 endif()
0068
0069 if (Raqm_INCLUDE_DIR AND Raqm_LIBRARY)
0070 set(Raqm_FOUND ON)
0071 else()
0072 set(Raqm_FOUND OFF)
0073 endif()
0074
0075 find_package_handle_standard_args(Raqm
0076 FOUND_VAR Raqm_FOUND
0077 REQUIRED_VARS Raqm_INCLUDE_DIR Raqm_LIBRARY
0078 HANDLE_COMPONENTS
0079 VERSION_VAR Raqm_VERSION
0080 )
0081
0082 if (Raqm_FOUND)
0083 if (Raqm_LIBRARY AND NOT TARGET Raqm::Raqm)
0084 add_library(Raqm::Raqm UNKNOWN IMPORTED GLOBAL)
0085 set_target_properties(Raqm::Raqm PROPERTIES
0086 IMPORTED_LOCATION "${Raqm_LIBRARY}"
0087 INTERFACE_COMPILE_OPTIONS "${PC_RAQM_CFLAGS_OTHER}"
0088 INTERFACE_INCLUDE_DIRECTORIES "${Raqm_INCLUDE_DIR}"
0089 INTERFACE_LINK_LIBRARIES "${PC_RAQM_LINK_LIBRARIES}"
0090 INTERFACE_LINK_DIRECTORIES "${PC_RAQM_LIBDIR}"
0091 )
0092 endif ()
0093
0094 mark_as_advanced(
0095 Raqm_INCLUDE_DIR
0096 Raqm_LIBRARY
0097 )
0098
0099 set(Raqm_LIBRARIES ${Raqm_LIBRARY})
0100 set(Raqm_INCLUDE_DIRS ${Raqm_INCLUDE_DIR})
0101 endif()