Warning, /frameworks/extra-cmake-modules/modules/ECMFindQmlModule.cmake is written in an unsupported language. File is not indexed.

0001 # SPDX-FileCopyrightText: 2015 Aleix Pol Gonzalez <aleixpol@blue-systems.com>
0002 #
0003 # SPDX-License-Identifier: BSD-3-Clause
0004 
0005 #[=======================================================================[.rst:
0006 ECMFindQmlModule
0007 ----------------
0008 
0009 Find QML import modules through a ``find_qmlmodule()`` call.
0010 It uses the qmlplugindump application to find the plugins and sets them up as
0011 runtime dependencies.
0012 
0013 This is useful so that when we configure a project we are notified when some
0014 QML imports are not present in the system, thus having the application compilable
0015 but fail at runtime.
0016 
0017 ::
0018 
0019   ecm_find_qmlmodule(<module_name> <version>...)
0020 
0021 Any further arguments passed will be forwarded into a ``find_package()`` call. See
0022 ``find_package()`` documentation for more information.
0023 
0024 Usage example:
0025 
0026 .. code-block:: cmake
0027 
0028   ecm_find_qmlmodule(org.kde.kirigami 2.1)
0029 
0030 Since 5.38.0.
0031 #]=======================================================================]
0032 
0033 set(MODULES_DIR ${CMAKE_CURRENT_LIST_DIR})
0034 
0035 function(ecm_find_qmlmodule MODULE_NAME VERSION)
0036     set(GENMODULE "${MODULE_NAME}-QMLModule")
0037 
0038     configure_file("${MODULES_DIR}/ECMFindQmlModule.cmake.in" "Find${GENMODULE}.cmake" @ONLY)
0039 
0040     set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_BINARY_DIR}" ${CMAKE_MODULE_PATH})
0041     find_package(${GENMODULE} ${ARGN})
0042 
0043     if(COMMAND set_package_properties)
0044         set_package_properties(${GENMODULE} PROPERTIES
0045             DESCRIPTION "QML module '${MODULE_NAME}' is a runtime dependency."
0046             TYPE RUNTIME)
0047     endif()
0048 endfunction()