From 34c1f88171f00a3e9fae57250799f3d3623b5f74 Mon Sep 17 00:00:00 2001 From: Andreas Sturmlechner Date: Tue, 17 Apr 2018 13:09:25 +0200 Subject: [PATCH] Fix build with Qt 5.11_beta3 (dropping qt5_use_modules) --- CMakeLists.txt | 3 --- TomahawkAddLibrary.cmake | 2 +- TomahawkUse.cmake.in | 3 --- src/crashreporter/CMakeLists.txt | 4 ++-- src/libtomahawk/CMakeLists.txt | 16 +++++++++------- src/tests/tomahawk_add_test.cmake | 6 ++++-- src/tomahawk/CMakeLists.txt | 9 +++++---- src/tools/database-reader/CMakeLists.txt | 2 +- src/tools/tomahawk-test-musicscan/CMakeLists.txt | 2 +- .../kdsingleapplicationguard/CMakeLists.txt | 2 +- .../src/certificate/CMakeLists.txt | 4 +--- thirdparty/qxt/qxtweb-standalone/CMakeLists.txt | 7 +------ 12 files changed, 26 insertions(+), 34 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7004e1b70..616db971f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -243,9 +243,6 @@ if( NOT Qt5Core_DIR ) macro_optional_find_package(Qt4 4.7.0 COMPONENTS ${NEEDED_QT4_COMPONENTS} ) macro_log_feature(QT4_FOUND "Qt" "A cross-platform application and UI framework" "http://qt-project.org" TRUE "" "If you see this, although libqt4-devel is installed, check whether the \n qtwebkit-devel package and whatever contains QtUiTools is installed too") - macro(qt5_use_modules) - endmacro() - macro(qt_wrap_ui) qt4_wrap_ui(${ARGN}) endmacro() diff --git a/TomahawkAddLibrary.cmake b/TomahawkAddLibrary.cmake index 384394e45..83ab365a0 100644 --- a/TomahawkAddLibrary.cmake +++ b/TomahawkAddLibrary.cmake @@ -46,7 +46,7 @@ function(tomahawk_add_library) endif() # HACK: add qt modules - every lib should define its own set of modules - qt5_use_modules(${target} Core Network Widgets Sql Xml ${LIBRARY_QT5_MODULES}) + target_link_libraries(${target} Qt5::Core Qt5::Network Qt5::Widgets Qt5::Sql Qt5::Xml) # definitions - can this be moved into set_target_properties below? add_definitions(${QT_DEFINITIONS}) diff --git a/TomahawkUse.cmake.in b/TomahawkUse.cmake.in index cb39fe219..9401e1851 100644 --- a/TomahawkUse.cmake.in +++ b/TomahawkUse.cmake.in @@ -81,9 +81,6 @@ else(TOMAHAWK_QT5) find_package(Qt4 4.7.0 COMPONENTS ${NEEDED_QT4_COMPONENTS}) include( ${QT_USE_FILE} ) - macro(qt5_use_modules) - endmacro() - macro(qt_wrap_ui) qt4_wrap_ui(${ARGN}) endmacro() diff --git a/src/crashreporter/CMakeLists.txt b/src/crashreporter/CMakeLists.txt index b837eb941..bccbcfc36 100644 --- a/src/crashreporter/CMakeLists.txt +++ b/src/crashreporter/CMakeLists.txt @@ -43,7 +43,7 @@ target_link_libraries( ${TOMAHAWK_CRASH_REPORTER_TARGET} ${QT_LIBRARIES} ) +target_link_libraries(${TOMAHAWK_CRASH_REPORTER_TARGET} Qt5::Widgets Qt5::Network) + set_target_properties(${TOMAHAWK_CRASH_REPORTER_TARGET} PROPERTIES AUTOMOC ON) install(TARGETS ${TOMAHAWK_CRASH_REPORTER_TARGET} RUNTIME DESTINATION ${CMAKE_INSTALL_LIBEXECDIR}) - -qt5_use_modules(${TOMAHAWK_CRASH_REPORTER_TARGET} Widgets Network) diff --git a/src/libtomahawk/CMakeLists.txt b/src/libtomahawk/CMakeLists.txt index adb3edfa0..35e38d8bc 100644 --- a/src/libtomahawk/CMakeLists.txt +++ b/src/libtomahawk/CMakeLists.txt @@ -500,12 +500,15 @@ set_target_properties( OUTPUT_NAME ${TOMAHAWK_BASE_TARGET_NAME} ) - -qt5_use_modules(${TOMAHAWK_LIBRARY} Widgets Network Sql WebKitWidgets Concurrent Xml UiTools Svg) -IF(APPLE) - qt5_use_modules(${TOMAHAWK_LIBRARY} MacExtras) -ENDIF() - +target_link_libraries(${TOMAHAWK_LIBRARY} + Qt5::Widgets Qt5::Network Qt5::Sql Qt5::WebKitWidgets Qt5::Concurrent Qt5::Xml Qt5::UiTools Qt5::Svg +) +if(APPLE) + target_link_libraries(${TOMAHAWK_LIBRARY} Qt5::MacExtras) +endif() +if( UNIX AND NOT APPLE ) + target_link_libraries(${TOMAHAWK_LIBRARY} Qt5::DBus) +endif() IF(QCA2_FOUND) INCLUDE_DIRECTORIES( ${QCA2_INCLUDE_DIR} ) @@ -514,7 +517,6 @@ ENDIF(QCA2_FOUND) IF( UNIX AND NOT APPLE ) LIST(APPEND LINK_LIBRARIES ${QT_QTDBUS_LIBRARIES} ) - qt5_use_modules(${TOMAHAWK_LIBRARY} DBus) ENDIF( UNIX AND NOT APPLE ) TARGET_LINK_LIBRARIES( ${TOMAHAWK_LIBRARY} diff --git a/src/tests/tomahawk_add_test.cmake b/src/tests/tomahawk_add_test.cmake index 464b8c918..9cfe9c46e 100644 --- a/src/tests/tomahawk_add_test.cmake +++ b/src/tests/tomahawk_add_test.cmake @@ -16,8 +16,10 @@ macro(tomahawk_add_test test_class) ${QT_QTCORE_LIBRARY} ) + target_link_libraries(${TOMAHAWK_TEST_TARGET} + Qt5::Core Qt5::Network Qt5::Widgets Qt5::Sql Qt5::Xml Qt5::Test + ) + add_test(NAME ${TOMAHAWK_TEST_TARGET} COMMAND ${TOMAHAWK_TEST_TARGET}) - qt5_use_modules(${TOMAHAWK_TEST_TARGET} Core Network Widgets Sql Xml Test) - endmacro() diff --git a/src/tomahawk/CMakeLists.txt b/src/tomahawk/CMakeLists.txt index cb60b8012..2659e85fe 100644 --- a/src/tomahawk/CMakeLists.txt +++ b/src/tomahawk/CMakeLists.txt @@ -171,13 +171,14 @@ SET_TARGET_PROPERTIES( ${TOMAHAWK_APPLICATION_TARGET} RUNTIME_OUTPUT_NAME ${TOMAHAWK_RUNTIME_OUTPUT_NAME} ) - -qt5_use_modules(${TOMAHAWK_APPLICATION_TARGET} Core Widgets Network Sql WebKitWidgets) +target_link_libraries(${TOMAHAWK_APPLICATION_TARGET} + Qt5::Core Qt5::Widgets Qt5::Network Qt5::Sql Qt5::WebKitWidgets +) if(APPLE) - qt5_use_modules(${TOMAHAWK_APPLICATION_TARGET} MacExtras) + target_link_libraries(${TOMAHAWK_APPLICATION_TARGET} Qt5::MacExtras) endif() if(WIN32) - qt5_use_modules(${TOMAHAWK_APPLICATION_TARGET} WinExtras) + target_link_libraries(${TOMAHAWK_APPLICATION_TARGET} Qt5::WinExtras) endif() MESSAGE( STATUS "OS_SPECIFIC_LINK_LIBRARIES: ${OS_SPECIFIC_LINK_LIBRARIES}" ) diff --git a/src/tools/database-reader/CMakeLists.txt b/src/tools/database-reader/CMakeLists.txt index 72bb1e0db..afad1c69d 100644 --- a/src/tools/database-reader/CMakeLists.txt +++ b/src/tools/database-reader/CMakeLists.txt @@ -15,7 +15,7 @@ set_target_properties( ${TOMAHAWK_TOOL_DB_LIST_ARTISTS_TARGET} target_link_libraries( ${TOMAHAWK_TOOL_DB_LIST_ARTISTS_TARGET} ${TOMAHAWK_LIBRARIES} ) +target_link_libraries(${TOMAHAWK_TOOL_DB_LIST_ARTISTS_TARGET} Qt5::Core) -qt5_use_modules(${TOMAHAWK_TOOL_DB_LIST_ARTISTS_TARGET} Core) install( TARGETS ${TOMAHAWK_TOOL_DB_LIST_ARTISTS_TARGET} BUNDLE DESTINATION . RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} ) diff --git a/src/tools/tomahawk-test-musicscan/CMakeLists.txt b/src/tools/tomahawk-test-musicscan/CMakeLists.txt index 097e3fc08..bca62f30b 100644 --- a/src/tools/tomahawk-test-musicscan/CMakeLists.txt +++ b/src/tools/tomahawk-test-musicscan/CMakeLists.txt @@ -14,6 +14,6 @@ set_target_properties( ${TOMAHAWK_TOOL_MUSICSCAN_TARGET} target_link_libraries( ${TOMAHAWK_TOOL_MUSICSCAN_TARGET} ${TOMAHAWK_LIBRARIES} ) +target_link_libraries(${TOMAHAWK_TOOL_MUSICSCAN_TARGET} Qt5::Core Qt5::Gui Qt5::Network Qt5::Widgets) -qt5_use_modules(${TOMAHAWK_TOOL_MUSICSCAN_TARGET} Core Gui Network Widgets) install( TARGETS ${TOMAHAWK_TOOL_MUSICSCAN_TARGET} BUNDLE DESTINATION . RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} ) diff --git a/thirdparty/kdsingleapplicationguard/CMakeLists.txt b/thirdparty/kdsingleapplicationguard/CMakeLists.txt index af4cf8704..70b644b49 100644 --- a/thirdparty/kdsingleapplicationguard/CMakeLists.txt +++ b/thirdparty/kdsingleapplicationguard/CMakeLists.txt @@ -24,4 +24,4 @@ set_target_properties( PROPERTIES AUTOMOC TRUE ) -qt5_use_modules(kdsingleapplicationguard Core) +target_link_libraries(kdsingleapplicationguard Qt5::Core) diff --git a/thirdparty/qt-certificate-addon/src/certificate/CMakeLists.txt b/thirdparty/qt-certificate-addon/src/certificate/CMakeLists.txt index a51157cf7..d67583843 100644 --- a/thirdparty/qt-certificate-addon/src/certificate/CMakeLists.txt +++ b/thirdparty/qt-certificate-addon/src/certificate/CMakeLists.txt @@ -25,6 +25,4 @@ set_target_properties( PROPERTIES AUTOMOC TRUE ) -qt5_use_modules(qtcertificateaddon Core Network) - - +target_link_libraries(qtcertificateaddon Qt5::Core Qt5::Network) diff --git a/thirdparty/qxt/qxtweb-standalone/CMakeLists.txt b/thirdparty/qxt/qxtweb-standalone/CMakeLists.txt index 654a6aab5..d44f967c3 100644 --- a/thirdparty/qxt/qxtweb-standalone/CMakeLists.txt +++ b/thirdparty/qxt/qxtweb-standalone/CMakeLists.txt @@ -73,11 +73,6 @@ ADD_LIBRARY( qxtweb-standalone STATIC ${sources} ) - -target_link_libraries( qxtweb-standalone - ${QT_LIBRARIES} -) - -qt5_use_modules( qxtweb-standalone Network ) +target_link_libraries( qxtweb-standalone Qt5::Network) set_target_properties( qxtweb-standalone PROPERTIES AUTOMOC TRUE )