From 0c31474ed3e0698f0126c5aba27baf8972358244 Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Tue, 4 Jul 2023 09:19:42 +0200 Subject: [PATCH] Wizards/CMake: Make sure GNUInstallDirs is included Qt 6.4 automatically includes GNUInstallDirs, but before that it didn't. And for the "plain" projects Qt isn't even used. Since the project templates use CMAKE_INSTALL_LIBDIR etc, they must ensure themselves that these are actually available. Fixes: QTCREATORBUG-29067 Change-Id: Id304b829301a33720d8f6c4a9c89157e8fc1c4a9 Reviewed-by: Alexandru Croitor --- .../studio_templates/projects/common/CMakeLists.main.txt.tpl | 1 + share/qtcreator/templates/wizards/codesnippet/CMakeLists.txt | 1 + .../templates/wizards/projects/consoleapp/CMakeLists.txt | 1 + share/qtcreator/templates/wizards/projects/plainc/CMakeLists.txt | 1 + .../qtcreator/templates/wizards/projects/plaincpp/CMakeLists.txt | 1 + .../templates/wizards/projects/qtquickapplication/CMakeLists.txt | 1 + .../projects/qtquickapplication_compat/CMakeLists.6.x.txt | 1 + .../wizards/projects/qtquickapplication_compat/CMakeLists.txt | 1 + .../wizards/projects/qtwidgetsapplication/CMakeLists.txt | 1 + 9 files changed, 9 insertions(+) diff --git a/share/qtcreator/qmldesigner/studio_templates/projects/common/CMakeLists.main.txt.tpl b/share/qtcreator/qmldesigner/studio_templates/projects/common/CMakeLists.main.txt.tpl index ef31652b0eb..0adf6e1c98e 100644 --- a/share/qtcreator/qmldesigner/studio_templates/projects/common/CMakeLists.main.txt.tpl +++ b/share/qtcreator/qmldesigner/studio_templates/projects/common/CMakeLists.main.txt.tpl @@ -38,6 +38,7 @@ if (LINK_INSIGHT) include(${CMAKE_CURRENT_SOURCE_DIR}/insight) endif () +include(GNUInstallDirs) install(TARGETS %{ProjectName}App BUNDLE DESTINATION . LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} diff --git a/share/qtcreator/templates/wizards/codesnippet/CMakeLists.txt b/share/qtcreator/templates/wizards/codesnippet/CMakeLists.txt index 325903743c0..0e923c87945 100644 --- a/share/qtcreator/templates/wizards/codesnippet/CMakeLists.txt +++ b/share/qtcreator/templates/wizards/codesnippet/CMakeLists.txt @@ -24,6 +24,7 @@ endif() target_link_libraries(%{ProjectName} PRIVATE Qt${QT_VERSION_MAJOR}::%{QtModule}) +include(GNUInstallDirs) install(TARGETS %{ProjectName} @if %{MacOSBundle} BUNDLE DESTINATION . diff --git a/share/qtcreator/templates/wizards/projects/consoleapp/CMakeLists.txt b/share/qtcreator/templates/wizards/projects/consoleapp/CMakeLists.txt index 7be8ecf05aa..a6f956127dd 100644 --- a/share/qtcreator/templates/wizards/projects/consoleapp/CMakeLists.txt +++ b/share/qtcreator/templates/wizards/projects/consoleapp/CMakeLists.txt @@ -35,6 +35,7 @@ else() endif() @endif +include(GNUInstallDirs) install(TARGETS %{ProjectName} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} diff --git a/share/qtcreator/templates/wizards/projects/plainc/CMakeLists.txt b/share/qtcreator/templates/wizards/projects/plainc/CMakeLists.txt index 49bf10a0890..1a0a570e66f 100644 --- a/share/qtcreator/templates/wizards/projects/plainc/CMakeLists.txt +++ b/share/qtcreator/templates/wizards/projects/plainc/CMakeLists.txt @@ -4,6 +4,7 @@ project(%{ProjectName} LANGUAGES C) add_executable(%{ProjectName} %{CFileName}) +include(GNUInstallDirs) install(TARGETS %{ProjectName} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} diff --git a/share/qtcreator/templates/wizards/projects/plaincpp/CMakeLists.txt b/share/qtcreator/templates/wizards/projects/plaincpp/CMakeLists.txt index 232bf6d489c..df5ef8a5cce 100644 --- a/share/qtcreator/templates/wizards/projects/plaincpp/CMakeLists.txt +++ b/share/qtcreator/templates/wizards/projects/plaincpp/CMakeLists.txt @@ -7,6 +7,7 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON) add_executable(%{ProjectName} %{CppFileName}) +include(GNUInstallDirs) install(TARGETS %{ProjectName} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} diff --git a/share/qtcreator/templates/wizards/projects/qtquickapplication/CMakeLists.txt b/share/qtcreator/templates/wizards/projects/qtquickapplication/CMakeLists.txt index 92e2a825af7..4166c0217ff 100644 --- a/share/qtcreator/templates/wizards/projects/qtquickapplication/CMakeLists.txt +++ b/share/qtcreator/templates/wizards/projects/qtquickapplication/CMakeLists.txt @@ -39,6 +39,7 @@ target_link_libraries(%{TargetName} PRIVATE Qt6::Quick ) +include(GNUInstallDirs) install(TARGETS %{TargetName} BUNDLE DESTINATION . LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} diff --git a/share/qtcreator/templates/wizards/projects/qtquickapplication_compat/CMakeLists.6.x.txt b/share/qtcreator/templates/wizards/projects/qtquickapplication_compat/CMakeLists.6.x.txt index 9d2fc4a82cc..d8e87ead7b4 100644 --- a/share/qtcreator/templates/wizards/projects/qtquickapplication_compat/CMakeLists.6.x.txt +++ b/share/qtcreator/templates/wizards/projects/qtquickapplication_compat/CMakeLists.6.x.txt @@ -28,6 +28,7 @@ set_target_properties(%{TargetName} PROPERTIES target_link_libraries(%{TargetName} PRIVATE Qt6::Quick) +include(GNUInstallDirs) install(TARGETS %{TargetName} BUNDLE DESTINATION . LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) diff --git a/share/qtcreator/templates/wizards/projects/qtquickapplication_compat/CMakeLists.txt b/share/qtcreator/templates/wizards/projects/qtquickapplication_compat/CMakeLists.txt index 3b5806eb093..4d35317a9fe 100644 --- a/share/qtcreator/templates/wizards/projects/qtquickapplication_compat/CMakeLists.txt +++ b/share/qtcreator/templates/wizards/projects/qtquickapplication_compat/CMakeLists.txt @@ -69,6 +69,7 @@ set_target_properties(%{ProjectName} PROPERTIES WIN32_EXECUTABLE TRUE ) +include(GNUInstallDirs) install(TARGETS %{ProjectName} BUNDLE DESTINATION . LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) diff --git a/share/qtcreator/templates/wizards/projects/qtwidgetsapplication/CMakeLists.txt b/share/qtcreator/templates/wizards/projects/qtwidgetsapplication/CMakeLists.txt index 8856a476b9e..4bda9db7a79 100644 --- a/share/qtcreator/templates/wizards/projects/qtwidgetsapplication/CMakeLists.txt +++ b/share/qtcreator/templates/wizards/projects/qtwidgetsapplication/CMakeLists.txt @@ -72,6 +72,7 @@ set_target_properties(%{ProjectName} PROPERTIES WIN32_EXECUTABLE TRUE ) +include(GNUInstallDirs) install(TARGETS %{ProjectName} BUNDLE DESTINATION . LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}