CMake Wizards: Advertise manual finalisation

In qmake projects it is possible to run arbitrary qmake commands after
the whole project is parsed, which is used extensively by Qt to do
things like importing qml plugins, generating android deployment
files, etc.

In CMake this feature was implemented in 3.19+ and we leverage this
feature to do all the things described above when such a version is
used.

But when projects are built with earlier CMake versions, it's better
for users to do these steps manually, rather than letting them to
happen at qt_add_executable call time, which limits certain
configurability.

That can be achieved by adding a call to qt_finalize_executable at the
very end of the directory scope where the target was created,
in addition to adding the MANUAL_FINALIZATION option to the
qt_add_executable call.

Augment the wizard templates to advertise the existence of
qt_finalize_executable, as well as making sure that projects created
by Creator can work reasonably well with older CMake versions as well.

Change-Id: Icf60eae993cf815f6cce6ed659fe35264b016f62
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
Alexandru Croitor
2021-03-12 11:57:24 +01:00
parent 4fe9b631af
commit 27f299d9b5
2 changed files with 7 additions and 0 deletions

View File

@@ -44,6 +44,7 @@ set(PROJECT_SOURCES
if(${QT_VERSION_MAJOR} GREATER_EQUAL 6) if(${QT_VERSION_MAJOR} GREATER_EQUAL 6)
qt_add_executable(%{ProjectName} qt_add_executable(%{ProjectName}
MANUAL_FINALIZATION
${PROJECT_SOURCES} ${PROJECT_SOURCES}
) )
@if %{HasTranslation} @if %{HasTranslation}
@@ -79,4 +80,5 @@ set_target_properties(%{ProjectName} PROPERTIES
if(QT_VERSION_MAJOR EQUAL 6) if(QT_VERSION_MAJOR EQUAL 6)
qt_import_qml_plugins(%{ProjectName}) qt_import_qml_plugins(%{ProjectName})
qt_finalize_executable(%{ProjectName})
endif() endif()

View File

@@ -48,6 +48,7 @@ set(PROJECT_SOURCES
if(${QT_VERSION_MAJOR} GREATER_EQUAL 6) if(${QT_VERSION_MAJOR} GREATER_EQUAL 6)
qt_add_executable(%{ProjectName} qt_add_executable(%{ProjectName}
MANUAL_FINALIZATION
${PROJECT_SOURCES} ${PROJECT_SOURCES}
) )
@if %{HasTranslation} @if %{HasTranslation}
@@ -77,3 +78,7 @@ set_target_properties(%{ProjectName} PROPERTIES
MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION} MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION}
MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR} MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}
) )
if(QT_VERSION_MAJOR EQUAL 6)
qt_finalize_executable(%{ProjectName})
endif()