ECMFindQmlModule — Extra CMake Modules 6.28.0 documentation

# ECMFindQmlModule

Finds QML import modules to set them as dependencies.

Because QML modules are not hard compile time requirements, they can be easy to miss by packagers and developers, causing suboptimal build results or runtime issues. Use this CMake module to ensure a QML module is installed at compile time during CMake configuration.

Internally, this CMake module looks for the qmldir and, if needed, uses qmlplugindump to find the plugins and set them up as dependencies.

    ecm_find_qmlmodule(<module_name>
      <version> # Optional for Qt6 builds
      [REQUIRED] # Since 6.0
    )

Usage example:

    ecm_find_qmlmodule(org.kde.kirigami 2.1)
    ecm_find_qmlmodule(org.kde.kirigami 2.1 REQUIRED) # CMake will fail if the required version is not found
    ecm_find_qmlmodule(org.kde.kirigami) # Find it without a given version
    ecm_find_qmlmodule(org.kde.kirigami REQUIRED) # CMake will fail if it is not found

Since 5.38.0.