From e2c02c5b20ce126c55b11b1c15ec9a7e2735e644 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Wed, 7 Aug 2024 16:17:53 +0200 Subject: [PATCH] CMake: Fix qt_add_ui for CMake 3.16 qt_add_ui failed for CMake 3.16 and the Ninja generator on Linux, because it generated empty commands like ... && "" && "" && "" && "" for targets that don't have AUTOUIC set. Adjust the generator expressions for those commands to generate the "cmake -E true" command instead of the empty string. Change-Id: I03c9eb2e8f14685bccadf4eb74f309bcf152c01b Reviewed-by: Alexandru Croitor (cherry picked from commit e98517564fa0a87ff030deb1cb05ec51aa231294) Reviewed-by: Qt Cherry-pick Bot --- src/widgets/Qt6WidgetsMacros.cmake | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/src/widgets/Qt6WidgetsMacros.cmake b/src/widgets/Qt6WidgetsMacros.cmake index a7ff7af2f38..2df25812fd1 100644 --- a/src/widgets/Qt6WidgetsMacros.cmake +++ b/src/widgets/Qt6WidgetsMacros.cmake @@ -290,20 +290,24 @@ function(qt6_add_ui target) "${CMAKE_CURRENT_BINARY_DIR}/${target}_autogen" COMMAND ${CMAKE_COMMAND} -E touch ${ui_property_check_dummy_file} COMMAND - "$<$>:${CMAKE_COMMAND}\ -;-E;echo;${error_message_1}>" + "$>,\ +${CMAKE_COMMAND};-E;echo;${error_message_1},\ +${CMAKE_COMMAND};-E;true>" COMMAND - "$<$>:${CMAKE_COMMAND}\ -;-E;echo;${error_message_2}>" + "$>,\ +${CMAKE_COMMAND};-E;echo;${error_message_2},\ +${CMAKE_COMMAND};-E;true>" # Remove the dummy file so that the error message is shown until # the AUTOUIC is disabled. Otherwise, the error message is shown # only once when the AUTOUIC is enabled with Visual Studio generator. COMMAND - "$<$>:${CMAKE_COMMAND}\ -;-E;remove;${ui_property_check_dummy_file}>" + "$>,\ +${CMAKE_COMMAND};-E;remove;${ui_property_check_dummy_file},\ +${CMAKE_COMMAND};-E;true>" COMMAND - "$<$>:${CMAKE_COMMAND}\ -;-E;false>" + "$>,\ +${CMAKE_COMMAND};-E;false,\ +${CMAKE_COMMAND};-E;true>" COMMAND_EXPAND_LISTS VERBATIM)