Details
-
Technical task
-
Resolution: Fixed
-
P4: Low
-
None
Description
qmake projects can have
# example.pro QT += core gui greaterThan(QT_MAJOR_VERSION, 4) { QT += widgets }
which pro2cmake.py converts to
# CMakeLists.txt
find_package(Qt6 COMPONENTS Core)
find_package(Qt6 COMPONENTS Gui)
if((QT_MAJOR_VERSION GREATER 4))
# should be added here by pro2cmake.py
#find_package(Qt6 COMPONENTS Widgets)
target_link_libraries(qt6-hello-world PUBLIC
Qt::Widgets
)
endif()
but QT_MAJOR_VERSION is not set
test:
# CMakeLists.txt message("debug: QT_MAJOR_VERSION = ${QT_MAJOR_VERSION}") message("debug: QT_VERSION = ${QT_VERSION}") message("debug: QT_PACKAGE_VERSION = ${QT_PACKAGE_VERSION}") message("debug: QT_DEFAULT_MAJOR_VERSION = ${QT_DEFAULT_MAJOR_VERSION}")
result:
debug: QT_MAJOR_VERSION = debug: QT_VERSION = debug: QT_PACKAGE_VERSION = debug: QT_DEFAULT_MAJOR_VERSION = 6
alternative: in pro2cmake.py, translate QT_MAJOR_VERSION to QT_DEFAULT_MAJOR_VERSION
Attachments
For Gerrit Dashboard: QTBUG-98852 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
399048,5 | pro2cmake: Generate find_package call for Qt5/Qt6 for examples | dev | qt/qtbase | Status: MERGED | +2 | 0 |
399078,4 | pro2cmake: Handle QT_(MAJOR_|MINOR_|PATCH_)VERSION conditions | dev | qt/qtbase | Status: MERGED | +2 | 0 |