diff --git a/cmake/KF5I18nMacros.cmake.in b/cmake/KF5I18nMacros.cmake.in --- a/cmake/KF5I18nMacros.cmake.in +++ b/cmake/KF5I18nMacros.cmake.in @@ -42,7 +42,7 @@ set(_ki18n_build_tsfiles_script ${CMAKE_CURRENT_LIST_DIR}/build-tsfiles.cmake) #create the implementation files from the ui files and add them to the list of sources -#usage: KI18N_WRAP_UI(foo_SRCS ${ui_files}) +#usage: KI18N_WRAP_UI(foo_SRCS ${ui_files}) or KI18N_WRAP_UI(TARGET ${ui_files}) macro (KI18N_WRAP_UI _sources ) if(NOT TARGET Qt5::uic) message(FATAL_ERROR "Qt5Widgets should be found before calling ki18n_wrap_ui(). Please add find_package(Qt5Widgets ...)") @@ -68,7 +68,11 @@ MAIN_DEPENDENCY ${_tmp_FILE} ) set_source_files_properties(${_header} PROPERTIES SKIP_AUTOMOC ON) - list(APPEND ${_sources} ${_header}) + if(TARGET ${_sources}) + target_sources(${_sources} PRIVATE ${_header}) + else() + list(APPEND ${_sources} ${_header}) + endif() endforeach (_current_FILE) endmacro (KI18N_WRAP_UI)