diff options
author | Maximilian Goldstein <max.goldstein@qt.io> | 2020-12-15 12:45:50 +0100 |
---|---|---|
committer | Maximilian Goldstein <max.goldstein@qt.io> | 2020-12-16 10:17:43 +0100 |
commit | 11fc3ecc81767f57dcf87f5c52c822e337ca1214 (patch) | |
tree | cd45501ffa8188f9890d57a034e819b1e79d34fb /src | |
parent | b67de9c660509596d6f02c1d5530b1faa327af89 (diff) |
Automatically create qmllint targets for modules
Adds ${TARGET}_qmllint targets to every qt module using qmlfiles.
You may specify additional import paths by adding them to QML2_IMPORT_PATH.
Change-Id: Icb920756a26c49db5e8edb9c0f691b90af9d5311
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'src')
-rw-r--r-- | src/qml/Qt6QmlMacros.cmake | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/qml/Qt6QmlMacros.cmake b/src/qml/Qt6QmlMacros.cmake index 3bfccfe3a8..f3fada0d02 100644 --- a/src/qml/Qt6QmlMacros.cmake +++ b/src/qml/Qt6QmlMacros.cmake @@ -615,6 +615,8 @@ function(qt6_target_qml_files target) endif() endif() + _qt_add_qmllint_command(${target} ${arg_FILES}) + set(file_contents "") foreach(qml_file IN LISTS arg_FILES) get_filename_component(qml_file_dir "${qml_file}" DIRECTORY) @@ -1214,3 +1216,19 @@ function(_qt_internal_qmldir_defer_file command filepath content) endif() endif() endfunction() + +function(_qt_add_qmllint_command target files) + get_target_property(target_source ${target} SOURCE_DIR) + get_target_property(includes ${target} QML2_IMPORT_PATH) + + if(includes) + foreach(dir in LISTS includes) + list(APPEND include_args "-I${dir}") + endforeach() + endif() + + add_custom_target(${target}_qmllint + ${QT_CMAKE_EXPORT_NAMESPACE}::qmllint ${files} ${include_args} + WORKING_DIRECTORY ${target_source} + ) +endfunction() |