Details
-
Bug
-
Resolution: Fixed
-
Not Evaluated
-
None
-
QDS 4.0.1
-
None
-
15193d325 (master)
Description
Qt Design Studio supports generating a
{CMakeLists.txt}via File > Export Project > Generate CMake Build Files. The generated CMakeLists.txt file can be simplified. Comments inline :
cmake_minimum_required(VERSION 3.21.1) set(BUILD_QDS_COMPONENTS ON CACHE BOOL "Build design studio components") project(UntitledProject2App LANGUAGES CXX) set(CMAKE_INCLUDE_CURRENT_DIR ON) ## Not needed set(CMAKE_AUTOMOC ON) find_package(QT NAMES Qt6 COMPONENTS Gui Qml Quick) ## Not needed find_package(Qt6 REQUIRED COMPONENTS Core Qml Quick) # To build this application you need Qt 6.2.0 or higher ## Better: Make this part of find_package: find_package(Qt6 6.2 REQUIRED COMPONENTS Quick) if (Qt6_VERSION VERSION_LESS 6.2.0) message(FATAL_ERROR "You need Qt 6.2.0 or newer to build the application.") endif() qt_add_executable(${CMAKE_PROJECT_NAME} 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. ## better: if (Qt6_VERSION VERSION_GREATER_EQUAL 6.3) if (${QT_VERSION_MINOR} GREATER_EQUAL 3) qt6_standard_project_setup() endif() qt_add_resources(${CMAKE_PROJECT_NAME} "configuration" PREFIX "/" FILES qtquickcontrols2.conf ) ## Juse use Qt6, e.g. Qt6::Core 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 ) if (${BUILD_QDS_COMPONENTS}) include(${CMAKE_CURRENT_SOURCE_DIR}/qmlcomponents) endif () include(${CMAKE_CURRENT_SOURCE_DIR}/qmlmodules) install(TARGETS ${CMAKE_PROJECT_NAME} BUNDLE DESTINATION . LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
Attachments
For Gerrit Dashboard: QDS-9700 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
472846,5 | Simplify generated CMakeLists.txt | master | qt-creator/qt-creator | Status: MERGED | +2 | 0 |