summaryrefslogtreecommitdiffstats
path: root/src/widgets/Qt6WidgetsMacros.cmake
diff options
context:
space:
mode:
Diffstat (limited to 'src/widgets/Qt6WidgetsMacros.cmake')
-rw-r--r--src/widgets/Qt6WidgetsMacros.cmake51
1 files changed, 51 insertions, 0 deletions
diff --git a/src/widgets/Qt6WidgetsMacros.cmake b/src/widgets/Qt6WidgetsMacros.cmake
new file mode 100644
index 0000000000..b15d1fe81d
--- /dev/null
+++ b/src/widgets/Qt6WidgetsMacros.cmake
@@ -0,0 +1,51 @@
+# Copyright 2005-2011 Kitware, Inc.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+######################################
+#
+# Macros for building Qt files
+#
+######################################
+
+
+# qt6_wrap_ui(outfiles inputfile ... )
+
+function(qt6_wrap_ui outfiles )
+ set(options)
+ set(oneValueArgs)
+ set(multiValueArgs OPTIONS)
+
+ cmake_parse_arguments(_WRAP_UI "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
+
+ set(ui_files ${_WRAP_UI_UNPARSED_ARGUMENTS})
+ set(ui_options ${_WRAP_UI_OPTIONS})
+
+ foreach(it ${ui_files})
+ get_filename_component(outfile ${it} NAME_WE)
+ get_filename_component(infile ${it} ABSOLUTE)
+ set(outfile ${CMAKE_CURRENT_BINARY_DIR}/ui_${outfile}.h)
+ add_custom_command(OUTPUT ${outfile}
+ DEPENDS ${QT_CMAKE_EXPORT_NAMESPACE}::uic
+ COMMAND ${QT_CMAKE_EXPORT_NAMESPACE}::uic
+ ARGS ${ui_options} -o ${outfile} ${infile}
+ MAIN_DEPENDENCY ${infile} VERBATIM)
+ set_source_files_properties(${infile} PROPERTIES SKIP_AUTOUIC ON)
+ set_source_files_properties(${outfile} PROPERTIES SKIP_AUTOMOC ON)
+ set_source_files_properties(${outfile} PROPERTIES SKIP_AUTOUIC ON)
+ list(APPEND ${outfiles} ${outfile})
+ endforeach()
+ set(${outfiles} ${${outfiles}} PARENT_SCOPE)
+endfunction()
+
+# This will override the CMake upstream command, because that one is for Qt 3.
+if(NOT QT_NO_CREATE_VERSIONLESS_FUNCTIONS)
+ function(qt_wrap_ui outfiles)
+ if(QT_DEFAULT_MAJOR_VERSION EQUAL 5)
+ qt5_wrap_ui("${outfiles}" ${ARGN})
+ elseif(QT_DEFAULT_MAJOR_VERSION EQUAL 6)
+ qt6_wrap_ui("${outfiles}" ${ARGN})
+ endif()
+ set("${outfiles}" "${${outfiles}}" PARENT_SCOPE)
+ endfunction()
+endif()