aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoerg Bornemann <[email protected]>2024-12-05 13:25:58 +0100
committerJoerg Bornemann <[email protected]>2024-12-06 16:10:18 +0100
commita9b8840e2695be83df2bd8a65a00be586614fd71 (patch)
tree37ead6049247c3ee490081907c52c4cbe74ecbeb
parent75c82354d9f2f4c86d9b5049bd0ea9fdc3fd0e78 (diff)
Don't write code for Qt5 and Qt6HEADdev
The --min-qt-version option doesn't accept anything lower than 6.0.0, so it doesn't make much sense to generate boilerplate code for supporting building with Qt 5 and 6. Much of what qmake2cmake generates is Qt6-only anyway. Fixes: QTBUG-104498 Change-Id: I461a48b46d659e9e567b1856f8dc19a6c73330e3 Reviewed-by: Alexey Edelev <[email protected]>
-rwxr-xr-xsrc/qmake2cmake/pro2cmake.py7
-rw-r--r--tests/data/conversion/subdirs/expected/CMakeLists.txt5
-rwxr-xr-xtests/test_conversion.py8
3 files changed, 7 insertions, 13 deletions
diff --git a/src/qmake2cmake/pro2cmake.py b/src/qmake2cmake/pro2cmake.py
index 9413dba..c14edfa 100755
--- a/src/qmake2cmake/pro2cmake.py
+++ b/src/qmake2cmake/pro2cmake.py
@@ -3834,16 +3834,13 @@ def write_top_level_find_package_section(
*,
indent: int = 0,
):
- # Write find_package call for Qt5/Qt6 and make it available as package QT.
- cm_fh.write("find_package(QT NAMES Qt5 Qt6 REQUIRED COMPONENTS Core)\n")
-
# Write find_package calls for required packages.
write_find_package_section(
cm_fh,
dependencies.required_libs,
indent=indent,
end_with_extra_newline=False,
- qt_package_name="Qt${QT_VERSION_MAJOR}",
+ qt_package_name="Qt6",
)
# Remove optional packages that are already required.
@@ -3856,7 +3853,7 @@ def write_top_level_find_package_section(
indent=indent,
is_required=False,
end_with_extra_newline=False,
- qt_package_name="Qt${QT_VERSION_MAJOR}",
+ qt_package_name="Qt6",
)
diff --git a/tests/data/conversion/subdirs/expected/CMakeLists.txt b/tests/data/conversion/subdirs/expected/CMakeLists.txt
index 36a4f57..7a497aa 100644
--- a/tests/data/conversion/subdirs/expected/CMakeLists.txt
+++ b/tests/data/conversion/subdirs/expected/CMakeLists.txt
@@ -9,9 +9,8 @@ set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOMOC ON)
include(GNUInstallDirs)
-find_package(QT NAMES Qt5 Qt6 REQUIRED COMPONENTS Core)
-find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Gui Network OpenGL)
-find_package(Qt${QT_VERSION_MAJOR} OPTIONAL_COMPONENTS Core5Compat)
+find_package(Qt6 REQUIRED COMPONENTS Gui Network OpenGL)
+find_package(Qt6 OPTIONAL_COMPONENTS Core5Compat)
qt_add_executable(app WIN32 MACOSX_BUNDLE
main.cpp
diff --git a/tests/test_conversion.py b/tests/test_conversion.py
index 0adbbbe..de049b4 100755
--- a/tests/test_conversion.py
+++ b/tests/test_conversion.py
@@ -76,17 +76,15 @@ def test_qt_modules():
for line in output.split("\n"):
if "find_package(" in line:
find_package_lines.append(line.strip())
- assert(["find_package(QT NAMES Qt5 Qt6 REQUIRED COMPONENTS Core)",
- "find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Network Widgets)"] == find_package_lines)
+ assert(["find_package(Qt6 REQUIRED COMPONENTS Network Widgets)"] == find_package_lines)
output = convert("optional_qt_modules")
find_package_lines = []
for line in output.split("\n"):
if "find_package(" in line:
find_package_lines.append(line.strip())
- assert(["find_package(QT NAMES Qt5 Qt6 REQUIRED COMPONENTS Core)",
- "find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Network Widgets)",
- "find_package(Qt${QT_VERSION_MAJOR} OPTIONAL_COMPONENTS OpenGL)"] == find_package_lines)
+ assert(["find_package(Qt6 REQUIRED COMPONENTS Network Widgets)",
+ "find_package(Qt6 OPTIONAL_COMPONENTS OpenGL)"] == find_package_lines)
def test_qt_version_check():
'''Test the conversion of QT_VERSION checks.'''