diff options
-rwxr-xr-x | src/qmake2cmake/pro2cmake.py | 7 | ||||
-rw-r--r-- | tests/data/conversion/subdirs/expected/CMakeLists.txt | 5 | ||||
-rwxr-xr-x | tests/test_conversion.py | 8 |
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.''' |