diff --git a/cmake/PhononQt4.cmake b/cmake/PhononQt4.cmake --- a/cmake/PhononQt4.cmake +++ b/cmake/PhononQt4.cmake @@ -62,31 +62,6 @@ find_package(Qt4) macro_log_feature(QT4_FOUND "Qt4" "" "" TRUE) -# ----- compat -macro (qt5_use_modules target) - set(_deps "") - foreach (arg ${ARGN}) - if (arg STREQUAL "Core") - list(APPEND _deps ${QT_QTCORE_LIBRARY}) - elseif (arg STREQUAL "Gui") - list(APPEND _deps ${QT_QTGUI_LIBRARY}) - elseif (arg STREQUAL "Widgets") - list(APPEND _deps ${QT_QTGUI_LIBRARY}) - elseif (arg STREQUAL "DBus") - list(APPEND _deps ${QT_QTDBUS_LIBRARY}) - elseif (arg STREQUAL "OpenGL") - list(APPEND _deps ${QT_QTOPENGL_LIBRARY}) - elseif (arg STREQUAL "Declarative") - list(APPEND _deps ${QT_QTDECLARATIVE_LIBRARY}) - elseif (arg STREQUAL "Designer") - list(APPEND _deps ${QT_QTDESIGNER_LIBRARY}) - else () - message("qt5_use_modules could not map ${arg} to Qt 4") - endif () - endforeach () - target_link_libraries(${target} ${_deps}) -endmacro (qt5_use_modules target args) - macro (qt5_add_resources) qt4_add_resources(${ARGN}) endmacro (qt5_add_resources) diff --git a/declarative/CMakeLists.txt b/declarative/CMakeLists.txt --- a/declarative/CMakeLists.txt +++ b/declarative/CMakeLists.txt @@ -19,11 +19,11 @@ phonon_add_declarative_plugin(phononqmlplugin ${declarative_SRCS}) -target_link_libraries(phononqmlplugin - ${PHONON_LIBS} -) - -qt5_use_modules(phononqmlplugin Core Gui Declarative) +if(PHONON_BUILD_PHONON4QT5) + target_link_libraries(phononqmlplugin Qt5::Core Qt5::Gui Qt5::Declarative ${PHONON_LIBS}) +else() + target_link_libraries(phononqmlplugin ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY} ${QT_QTDECLARATIVE_LIBRARY} ${PHONON_LIBS}) +endif() install(TARGETS phononqmlplugin DESTINATION ${PHONON_QT_IMPORTS_INSTALL_DIR}/Phonon) install(FILES ${phonon_QMLS} DESTINATION ${PHONON_QT_IMPORTS_INSTALL_DIR}/Phonon) diff --git a/demos/metadatareader/CMakeLists.txt b/demos/metadatareader/CMakeLists.txt --- a/demos/metadatareader/CMakeLists.txt +++ b/demos/metadatareader/CMakeLists.txt @@ -13,5 +13,8 @@ phonon_add_executable(metadatareader ${metadatareader_SRCS}) -qt5_use_modules(metadatareader Core Widgets) -target_link_libraries(metadatareader ${PHONON_LIBRARY}) +if(PHONON_BUILD_PHONON4QT5) + target_link_libraries(metadatareader Qt5::Core Qt5::Widgets ${PHONON_LIBRARY}) +else() + target_link_libraries(metadatareader ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY} ${PHONON_LIBRARY}) +endif() diff --git a/demos/phota/CMakeLists.txt b/demos/phota/CMakeLists.txt --- a/demos/phota/CMakeLists.txt +++ b/demos/phota/CMakeLists.txt @@ -17,5 +17,8 @@ phonon_add_executable(phota ${phota_SRCS}) -qt5_use_modules(phota Core Widgets) -target_link_libraries(phota ${PHONON_LIBRARY}) +if(PHONON_BUILD_PHONON4QT5) + target_link_libraries(phota Qt5::Core Qt5::Widgets ${PHONON_LIBRARY}) +else() + target_link_libraries(phota ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY} ${PHONON_LIBRARY}) +endif() diff --git a/demos/simplecapture/CMakeLists.txt b/demos/simplecapture/CMakeLists.txt --- a/demos/simplecapture/CMakeLists.txt +++ b/demos/simplecapture/CMakeLists.txt @@ -13,5 +13,8 @@ phonon_add_executable(simplecapture ${simplecapture_SRCS}) -qt5_use_modules(simplecapture Core Widgets) -target_link_libraries(simplecapture ${PHONON_LIBRARY}) +if(PHONON_BUILD_PHONON4QT5) + target_link_libraries(simplecapture Qt5::Core Qt5::Widgets ${PHONON_LIBRARY}) +else() + target_link_libraries(simplecapture ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY} ${PHONON_LIBRARY}) +endif() diff --git a/demos/simpleplayer/CMakeLists.txt b/demos/simpleplayer/CMakeLists.txt --- a/demos/simpleplayer/CMakeLists.txt +++ b/demos/simpleplayer/CMakeLists.txt @@ -13,5 +13,8 @@ phonon_add_executable(simpleplayer ${simpleplayer_SRCS}) -qt5_use_modules(simpleplayer Core Widgets) -target_link_libraries(simpleplayer ${PHONON_LIBRARY}) +if(PHONON_BUILD_PHONON4QT5) + target_link_libraries(simpleplayer Qt5::Core Qt5::Widgets ${PHONON_LIBRARY}) +else() + target_link_libraries(simpleplayer ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY} ${PHONON_LIBRARY}) +endif() diff --git a/designer/CMakeLists.txt b/designer/CMakeLists.txt --- a/designer/CMakeLists.txt +++ b/designer/CMakeLists.txt @@ -11,10 +11,10 @@ phonon_add_designer_plugin(phononwidgets phononwidgets.qrc ${phononwidgetsplugin_SRCS}) -qt5_use_modules(phononwidgets Core Gui Widgets Designer) - -target_link_libraries(phononwidgets - ${PHONON_LIBS} -) +if(PHONON_BUILD_PHONON4QT5) + target_link_libraries(phononwidgets Qt5::Core Qt5::Gui Qt5::Widgets Qt5::Designer ${PHONON_LIBS}) +else() + target_link_libraries(phononwidgets ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY} ${QT_QTDESIGNER_LIBRARY} ${PHONON_LIBS}) +endif() install(TARGETS phononwidgets DESTINATION ${PHONON_QT_PLUGIN_INSTALL_DIR}) diff --git a/phonon/CMakeLists.txt b/phonon/CMakeLists.txt --- a/phonon/CMakeLists.txt +++ b/phonon/CMakeLists.txt @@ -137,25 +137,32 @@ add_definitions(-DPHONON_BACKEND_DIR_SUFFIX="/${PHONON_LIB_SONAME}_backend/") add_library(${PHONON_LIB_SONAME} SHARED ${phonon_LIB_SRCS}) -qt5_use_modules(${PHONON_LIB_SONAME} Core Widgets) -if(QT_QTDBUS_FOUND AND NOT PHONON_NO_DBUS) - qt5_use_modules(${PHONON_LIB_SONAME} DBus) -endif(QT_QTDBUS_FOUND AND NOT PHONON_NO_DBUS) +if(PHONON_BUILD_PHONON4QT5) + target_link_libraries(${PHONON_LIB_SONAME} Qt5::Core Qt5::Widgets) + if(QT_QTDBUS_FOUND AND NOT PHONON_NO_DBUS) + target_link_libraries(${PHONON_LIB_SONAME} Qt5::DBus) + endif(QT_QTDBUS_FOUND AND NOT PHONON_NO_DBUS) + if(NOT PHONON_NO_GRAPHICSVIEW) + target_link_libraries(${PHONON_LIB_SONAME} Qt5::OpenGL ${OPENGL_gl_LIBRARY}) + endif() +else() + target_link_libraries(${PHONON_LIB_SONAME} ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY}) + if(QT_QTDBUS_FOUND AND NOT PHONON_NO_DBUS) + target_link_libraries(${PHONON_LIB_SONAME} ${QT_QTDBUS_LIBRARY}) + endif(QT_QTDBUS_FOUND AND NOT PHONON_NO_DBUS) + if(NOT PHONON_NO_GRAPHICSVIEW) + target_link_libraries(${PHONON_LIB_SONAME} ${QT_QTOPENGL_LIBRARY} ${OPENGL_gl_LIBRARY}) + endif() + if (QZEITGEIST_FOUND) + target_link_libraries(${PHONON_LIB_SONAME} ${QZEITGEIST_LIBRARY}) + endif(QZEITGEIST_FOUND) +endif() if (PHONON_PULSESUPPORT) target_link_libraries(${PHONON_LIB_SONAME} ${GOBJECT_LIBRARIES} ${PULSEAUDIO_LIBRARY} ${PULSEAUDIO_MAINLOOP_LIBRARY}) endif (PHONON_PULSESUPPORT) -if(NOT PHONON_NO_GRAPHICSVIEW) - qt5_use_modules(${PHONON_LIB_SONAME} OpenGL) - target_link_libraries(${PHONON_LIB_SONAME} ${OPENGL_gl_LIBRARY}) -endif() - -if (QZEITGEIST_FOUND) - target_link_libraries(${PHONON_LIB_SONAME} ${QZEITGEIST_LIBRARY}) -endif(QZEITGEIST_FOUND) - if (${CMAKE_SYSTEM_NAME} MATCHES "SunOS") # We need to explicitly link libm to phonon in Solaris target_link_libraries(${PHONON_LIB_SONAME} m) diff --git a/phonon/experimental/CMakeLists.txt b/phonon/experimental/CMakeLists.txt --- a/phonon/experimental/CMakeLists.txt +++ b/phonon/experimental/CMakeLists.txt @@ -20,8 +20,13 @@ ../abstractvideooutput_p.cpp ) add_library(${PHONON_LIB_SONAME}experimental SHARED ${phononexperimental_LIB_SRCS}) -qt5_use_modules(${PHONON_LIB_SONAME}experimental Core Widgets) -target_link_libraries(${PHONON_LIB_SONAME}experimental ${PHONON_LIBS}) + +if(PHONON_BUILD_PHONON4QT5) + target_link_libraries(${PHONON_LIB_SONAME}experimental Qt5::Core Qt5::Widgets ${PHONON_LIBS}) +else() + target_link_libraries(${PHONON_LIB_SONAME}experimental ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY} ${PHONON_LIBS}) +endif() + set_target_properties(${PHONON_LIB_SONAME}experimental PROPERTIES VERSION ${PHONON_LIB_VERSION} SOVERSION ${PHONON_LIB_SOVERSION}