Skip to content

Commit

Permalink
Switch from Qt5 to Qt6 (#13)
Browse files Browse the repository at this point in the history
* Switch from Qt5 to Qt6 by default

- Fix compile with Qt6

* Use QT_MAJOR_VERSION and set to 6 as default
  • Loading branch information
sizeofvoid authored Jan 14, 2024
1 parent eb9a706 commit dbbc0d6
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
9 changes: 5 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.16.0)

# Version setup
set(OPENBSDISKS_VERSION_MAJOR "0")
set(OPENBSDISKS_VERSION_MINOR "4")
set(OPENBSDISKS_VERSION_MINOR "5")
set(OPENBSDISKS_VERSION_PATCH "0")
set(OPENBSDISKS_VERSION "${OPENBSDISKS_VERSION_MAJOR}.${OPENBSDISKS_VERSION_MINOR}.${OPENBSDISKS_VERSION_PATCH}")

Expand All @@ -17,6 +17,8 @@ if(NOT CMAKE_BUILD_TYPE)
FORCE)
endif()

set(QT_MAJOR_VERSION 6 CACHE STRING "Qt version to use (5 or 6), defaults to 6")

include(GNUInstallDirs)

option(INSTALL_POLKIT_RULES "Install polkit rules" OFF)
Expand All @@ -25,8 +27,7 @@ option(INSTALL_MAN_PAGES "Install man pages" ON)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOMOC ON)

set(QT5COMPONENTS Core DBus)
find_package(Qt5 COMPONENTS ${QT5COMPONENTS} REQUIRED)
find_package(Qt${QT_MAJOR_VERSION} COMPONENTS Core DBus REQUIRED)
find_package(Threads REQUIRED)

set(SOURCE
Expand All @@ -46,7 +47,7 @@ set(SOURCE
)
add_executable(openbsdisks2 ${SOURCE})

target_link_libraries(openbsdisks2 Qt5::DBus Qt5::Core util)
target_link_libraries(openbsdisks2 Qt${QT_MAJOR_VERSION}::DBus Qt${QT_MAJOR_VERSION}::Core util)

target_compile_features(openbsdisks2 PRIVATE cxx_std_17)
target_compile_options(openbsdisks2 PRIVATE "-Wall")
Expand Down
1 change: 0 additions & 1 deletion src/adaptors.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ class QByteArray;
template<class T> class QList;
template<class Key, class Value> class QMap;
class QString;
class QStringList;
class QVariant;

#include <QVariantMap>
Expand Down
2 changes: 1 addition & 1 deletion src/disk_label.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ void DiskLabel::analyseDev(const QString& dev)
for (int i = 0; i < lab.d_npartitions; i++) {
pp = &lab.d_partitions[i];
if (DL_GETPSIZE(pp) > 0) {
QString p('a' + i);
const QString p = QChar('a' + i);
if (p != QStringLiteral("c")) {
if (isValidFileSysetem(pp->p_fstype)) {
auto block = createBlock(
Expand Down
2 changes: 1 addition & 1 deletion src/manageradaptor.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
class QByteArray;
template<class T> class QList;
template<class Key, class Value> class QMap;

class QString;
class QStringList;
class QVariant;

typedef QMap<QString, QVariantMap> QVariantMapMap;
Expand Down

0 comments on commit dbbc0d6

Please sign in to comment.