diff --git a/CMakeLists.txt b/CMakeLists.txt index 6e62a97..3a7cb0a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -103,12 +103,23 @@ function(dtk_add_plugin) endfunction() find_package(Dtk${VERSION_SUFFIX} REQUIRED COMPONENTS Widget) -cmake_dependent_option(ENABLE_QT_XDG_ICON_LOADER "Enable QtXdgIconLoader" ON "QT_VERSION_MAJOR EQUAL 5" OFF) + +option(ENABLE_QT_XDG_ICON_LOADER "Enable QtXdgIconLoader" ON) +find_package(Qt${QT_VERSION_MAJOR}XdgIconLoader) +find_package(Qt${QT_VERSION_MAJOR}Xdg REQUIRED) +if (NOT Qt${QT_VERSION_MAJOR}XdgIconLoader_FOUND) + message(WARNING " Qt${QT_VERSION_MAJOR}XdgIconLoader Not Found, DISABLE QtXdgIconLoader !") + set (ENABLE_QT_XDG_ICON_LOADER OFF) +endif() + if(ENABLE_QT_XDG_ICON_LOADER) - find_package(Qt5XdgIconLoader REQUIRED) - find_package(Qt5Xdg REQUIRED) - set(QT_XDG_ICON_DEPS Qt5XdgIconLoader Qt5Xdg) - set(XDG_ICON_VERSION_MAJOR ${Qt5XdgIconLoader_VERSION_MAJOR}) + set(QT_XDG_ICON_DEPS Qt${QT_VERSION_MAJOR}XdgIconLoader Qt${QT_VERSION_MAJOR}Xdg) + + if("${QT_VERSION_MAJOR}" STREQUAL "5") + set(XDG_ICON_VERSION_MAJOR ${Qt5XdgIconLoader_VERSION_MAJOR}) + elseif("${QT_VERSION_MAJOR}" STREQUAL "6") + set(XDG_ICON_VERSION_MAJOR ${Qt6XdgIconLoader_VERSION_MAJOR}) + endif() endif() set(PLUGIN_OUTPUT_BASE_DIR ${CMAKE_BINARY_DIR}/plugins CACHE STRING "Plugin output base path") diff --git a/platformthemeplugin/CMakeLists.txt b/platformthemeplugin/CMakeLists.txt index 4ff3203..054739b 100644 --- a/platformthemeplugin/CMakeLists.txt +++ b/platformthemeplugin/CMakeLists.txt @@ -6,7 +6,7 @@ find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS DBus Widgets) set(QT_LIBS Qt${QT_VERSION_MAJOR}::DBus Qt${QT_VERSION_MAJOR}::Widgets) if(QT_VERSION_MAJOR EQUAL 5) find_package(Qt5X11Extras REQUIRED) - list(APPEND QT_LIBS Qt5::X11Extras ${QT_XDG_ICON_DEPS}) + list(APPEND QT_LIBS Qt5::X11Extras) if(QT_VERSION_MINOR GREATER_EQUAL 8) # Qt5.8 find_package(Qt5ThemeSupport REQUIRED) list(APPEND QT_LIBS Qt5::ThemeSupportPrivate) @@ -26,10 +26,12 @@ if(QT_VERSION_MAJOR EQUAL 5) else() list(APPEND QT_LIBS Qt6::GuiPrivate) endif() + find_package(PkgConfig REQUIRED) pkg_check_modules(Deps REQUIRED IMPORTED_TARGET mtdev x11) if(ENABLE_QT_XDG_ICON_LOADER) set(DEFS -DXDG_ICON_VERSION_MAR=${XDG_ICON_VERSION_MAJOR}) + list(APPEND QT_LIBS ${QT_XDG_ICON_DEPS}) endif() if(QT_VERSION_MAJOR EQUAL 5) qt5_add_dbus_interface(DBUS_INTERFACES ${CMAKE_CURRENT_LIST_DIR}/xmls/com.deepin.filemanager.filedialog.xml filedialog_interface)