From d8647910bc93eca06491b719105b2228c50cc556 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Fri, 20 Sep 2019 14:18:17 +0200 Subject: [PATCH] cmake: Init uic only if Qt::Widgets is a target Otherwise we get errors like the following in non-gui projects: Error evaluating generator expression: $ No target "Qt6::uic" Change-Id: I8a3a6f8ec5e5c1c3d1f73369c5739a321c64bfbb Reviewed-by: Alexandru Croitor --- cmake/QtBuildInternals/QtBuildInternalsConfig.cmake | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cmake/QtBuildInternals/QtBuildInternalsConfig.cmake b/cmake/QtBuildInternals/QtBuildInternalsConfig.cmake index a898d118c6..e8002b5550 100644 --- a/cmake/QtBuildInternals/QtBuildInternalsConfig.cmake +++ b/cmake/QtBuildInternals/QtBuildInternalsConfig.cmake @@ -175,7 +175,10 @@ macro(qt_examples_build_end) get_all_targets(targets "${CMAKE_CURRENT_SOURCE_DIR}") foreach(target ${targets}) - qt_autogen_tools(${target} ENABLE_AUTOGEN_TOOLS "moc" "uic" "rcc") + qt_autogen_tools(${target} ENABLE_AUTOGEN_TOOLS "moc" "rcc") + if(TARGET Qt::Widgets) + qt_autogen_tools(${target} ENABLE_AUTOGEN_TOOLS "uic") + endif() endforeach() set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ${BACKUP_CMAKE_FIND_ROOT_PATH_MODE_PACKAGE})