Skip to content

Commit

Permalink
Revert trying to find Qt5 and/or Qt6
Browse files Browse the repository at this point in the history
  • Loading branch information
probonopd authored Sep 23, 2023
1 parent d083642 commit 6d3bdb4
Showing 1 changed file with 21 additions and 30 deletions.
51 changes: 21 additions & 30 deletions styleplugin/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,27 +9,14 @@ set(CMAKE_INCLUDE_CURRENT_DIR ON)
find_package(ECM REQUIRED NO_MODULE)
set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/cmake)

# Find Qt5 or Qt6 based on availability
find_package(Qt5 QUIET COMPONENTS Core Gui Widgets DBus Multimedia)
find_package(Qt6 QUIET COMPONENTS Core Gui Widgets DBus Multimedia)

# Choose the Qt version to use
if(Qt6_FOUND)
set(QT_VERSION 6)
set(QT Core Gui Widgets DBus Multimedia)
elseif(Qt5_FOUND)
set(QT_VERSION 5)
set(QT Core Gui Widgets DBus Multimedia)
else()
message(FATAL_ERROR "Qt not found on the system.")
endif()

set(QT Core Gui Widgets DBus Multimedia)
find_package(Qt5 REQUIRED ${QT})
find_package(PkgConfig REQUIRED)
find_package(KF5 REQUIRED WindowSystem)

include(GNUInstallDirs)

set(SRCS
set (SRCS
pstyleplugin.cpp
pstyleplugin.h
basestyle.h
Expand All @@ -48,30 +35,34 @@ set(SRCS

add_library(${TARGET} MODULE ${SRCS})
target_link_libraries(${TARGET}
PRIVATE
Qt${QT_VERSION}::Core
Qt${QT_VERSION}::Gui
Qt${QT_VERSION}::Widgets
Qt${QT_VERSION}::DBus
Qt${QT_VERSION}::Multimedia
Qt5::GuiPrivate
Qt5::Core
Qt5::Gui
Qt5::Widgets
Qt5::DBus
KF5::WindowSystem
)
Qt5::Multimedia
)

set(SOUND_FILES
../sounds/ping.wav
)

# Manually set the Qt plugin directory
string(REGEX MATCH "Qt5 plugin directory:(.*)" QT_PLUGINS_DIR_MATCH "${CMAKE_MESSAGE_LOG}")
get_target_property(QT_QMAKE_EXECUTABLE ${Qt5Core_QMAKE_EXECUTABLE} IMPORTED_LOCATION)
if(NOT QT_QMAKE_EXECUTABLE)
message(FATAL_ERROR "qmake is not found.")
endif()

if(QT_PLUGINS_DIR_MATCH)
set(QT_PLUGINS_DIR "${CMAKE_MATCH_1}")
execute_process(COMMAND ${QT_QMAKE_EXECUTABLE} -query QT_INSTALL_PLUGINS
OUTPUT_VARIABLE QT_PLUGINS_DIR
OUTPUT_STRIP_TRAILING_WHITESPACE
)
if(QT_PLUGINS_DIR)
message(STATUS "Qt5 plugin directory:" "${QT_PLUGINS_DIR}")
else()
message(FATAL_ERROR "Qt plugin directory cannot be detected.")
message(FATAL_ERROR "Qt5 plugin directory cannot be detected.")
endif()

message(STATUS "Qt plugin directory: ${QT_PLUGINS_DIR}")

install(TARGETS ${TARGET} DESTINATION ${QT_PLUGINS_DIR}/styles/)

install(FILES ${SOUND_FILES} DESTINATION "${CMAKE_INSTALL_DATADIR}/panda/sounds")
Expand Down

0 comments on commit 6d3bdb4

Please sign in to comment.