From c3fee0d984e59cee3ab6d069011015dd850be98f Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Thu, 15 Oct 2020 17:58:15 +0200 Subject: CMake: Rename add_qt_gui_executable to qt_add_executable Also adjust pro2cmake to use the new qt_add_executable name instead of add_qt_gui_executable. No compatibility functions provided this time, so we'll need to follow through all repos and regenerate all examples. Two reasons for not providing compaitibility functions: 1) We don't intend add_qt_gui_executable to be public API 2) A previous case with qtquickcontrols2 and qttools pointed out that making top-level builds work with cross-compatibility API is not simple. So just go ahead and regenerate everything. Task-number: QTBUG-87661 Change-Id: I2f228827b786ae03bf7e1bf3908ea02a8794ed52 Reviewed-by: Joerg Bornemann --- src/corelib/Qt6CoreMacros.cmake | 9 ++++++++- util/cmake/pro2cmake.py | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/corelib/Qt6CoreMacros.cmake b/src/corelib/Qt6CoreMacros.cmake index 7b901b3c09..77c3128d52 100644 --- a/src/corelib/Qt6CoreMacros.cmake +++ b/src/corelib/Qt6CoreMacros.cmake @@ -426,7 +426,7 @@ set(_Qt6_COMPONENT_PATH "${CMAKE_CURRENT_LIST_DIR}/..") # It's signature and behavior might change. # # Wrapper function that adds an executable with some Qt specific behavior. -function(add_qt_gui_executable target) +function(qt6_add_executable target) if(ANDROID) add_library("${target}" MODULE ${ARGN}) # On our qmake builds we do don't compile the executables with @@ -456,6 +456,13 @@ function(add_qt_gui_executable target) endif() endfunction() +if(NOT QT_NO_CREATE_VERSIONLESS_FUNCTIONS) + function(qt_add_executable) + qt6_add_executable(${ARGV}) + endfunction() +endif() + + function(_qt_get_plugin_name_with_version target out_var) string(REGEX REPLACE "^Qt::(.+)" "Qt${QT_DEFAULT_MAJOR_VERSION}::\\1" qt_plugin_with_version "${target}") diff --git a/util/cmake/pro2cmake.py b/util/cmake/pro2cmake.py index 0e6f916f94..e1a1ed8e11 100755 --- a/util/cmake/pro2cmake.py +++ b/util/cmake/pro2cmake.py @@ -3719,7 +3719,7 @@ def write_example( add_target += f"target_sources({binary_name} PRIVATE" else: - add_target = f'add_{"qt_gui_" if gui else ""}executable({binary_name}' + add_target = f'qt_add_executable({binary_name}' write_all_source_file_lists(cm_fh, scope, add_target, indent=0) cm_fh.write(")\n") -- cgit v1.2.3