From fc236d4534468fc0867e30843a109d9274ebba70 Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Fri, 16 Jun 2023 14:31:39 +0200 Subject: [PATCH] Build: Avoid building Qt Creator when running translation targets The "project sources" contain lots of generated files that we are not interested in, simply exclude anything from the build directory. The *_tr.h header that we generate for the wizards and external tools are handled separately. Change-Id: I2ab1d6ac4312b1140ee475f8f16ba82d8488c43e Reviewed-by: Leena Miettinen Reviewed-by: Cristian Adam --- cmake/QtCreatorTranslations.cmake | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/cmake/QtCreatorTranslations.cmake b/cmake/QtCreatorTranslations.cmake index 4803d66be5e..94f28663483 100644 --- a/cmake/QtCreatorTranslations.cmake +++ b/cmake/QtCreatorTranslations.cmake @@ -30,7 +30,18 @@ function(_extract_ts_data_from_targets outprefix) set(_target_sources "") if(_source_files) - list(FILTER _source_files EXCLUDE REGEX ".*[.]json[.]in|.*[.]svg|.*[.]pro|.*[.]css") + # exclude various funny source files, and anything generated + # like *metatypes.json.gen, moc_*.cpp, qrc_*.cpp, */qmlcache/*.cpp, + # *qmltyperegistrations.cpp + set(_exclude_patterns + .*[.]json[.]in + .*[.]svg + .*[.]pro + .*[.]css + "${PROJECT_BINARY_DIR}/.*" + ) + list(JOIN _exclude_patterns "|" _exclude_pattern) + list(FILTER _source_files EXCLUDE REGEX "${_exclude_pattern}") list(APPEND _target_sources ${_source_files}) endif() if(_extra_translations)