diff options
author | Kai Köhne <kai.koehne@qt.io> | 2023-04-18 12:55:51 +0200 |
---|---|---|
committer | Kai Köhne <kai.koehne@qt.io> | 2023-05-05 08:35:43 +0000 |
commit | 15193d3250834f85d90b790c0c40632e6de65033 (patch) | |
tree | e47cc43044e8464312cfda569ed7657511810114 /share | |
parent | 328d4c72954736242138d5092980e65873a2a590 (diff) | |
download | qt-creator-15193d3250834f85d90b790c0c40632e6de65033.tar.gz |
Simplify generated CMakeLists.txt
Fixes: QDS-9700
Change-Id: I2376e3938fb6f95d2cc53ad96b40c04ac7ce780e
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Diffstat (limited to 'share')
-rw-r--r-- | share/qtcreator/qmldesigner/studio_templates/projects/common/CMakeLists.main.txt.tpl | 40 |
1 files changed, 17 insertions, 23 deletions
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 a76765daee..18aec1a93e 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 @@ -1,46 +1,40 @@ cmake_minimum_required(VERSION 3.21.1) -set(BUILD_QDS_COMPONENTS ON CACHE BOOL "Build design studio components") +option(BUILD_QDS_COMPONENTS "Build design studio components" ON) project(%{ProjectName}App LANGUAGES CXX) -set(CMAKE_INCLUDE_CURRENT_DIR ON) set(CMAKE_AUTOMOC ON) -find_package(QT NAMES Qt6 COMPONENTS Gui Qml Quick) -find_package(Qt6 REQUIRED COMPONENTS Core Qml Quick) +find_package(Qt6 6.2 REQUIRED COMPONENTS Core Gui Qml Quick) -# To build this application you need Qt 6.2.0 or higher -if (Qt6_VERSION VERSION_LESS 6.2.0) -message(FATAL_ERROR "You need Qt 6.2.0 or newer to build the application.") +if (Qt6_VERSION VERSION_GREATER_EQUAL 6.3) + qt_standard_project_setup() endif() -qt_add_executable(${CMAKE_PROJECT_NAME} src/main.cpp) +qt_add_executable(%{ProjectName}App src/main.cpp) -# qt_standard_project_setup() requires Qt 6.3 or higher. See https://doc.qt.io/qt-6/qt-standard-project-setup.html for details. -if (${QT_VERSION_MINOR} GREATER_EQUAL 3) -qt6_standard_project_setup() -endif() - -qt_add_resources(${CMAKE_PROJECT_NAME} "configuration" +qt_add_resources(%{ProjectName}App "configuration" PREFIX "/" FILES qtquickcontrols2.conf ) -target_link_libraries(${CMAKE_PROJECT_NAME} PRIVATE - Qt${QT_VERSION_MAJOR}::Core - Qt${QT_VERSION_MAJOR}::Gui - Qt${QT_VERSION_MAJOR}::Quick - Qt${QT_VERSION_MAJOR}::Qml +target_link_libraries(%{ProjectName}App PRIVATE + Qt6::Core + Qt6::Gui + Qt6::Qml + Qt6::Quick ) -if (${BUILD_QDS_COMPONENTS}) +if (BUILD_QDS_COMPONENTS) include(${CMAKE_CURRENT_SOURCE_DIR}/qmlcomponents) -endif () +endif() include(${CMAKE_CURRENT_SOURCE_DIR}/qmlmodules) -install(TARGETS ${CMAKE_PROJECT_NAME} +install(TARGETS %{ProjectName}App BUNDLE DESTINATION . - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} +) |