diff --git a/cmake/Modules/MacroLinkQtComponents.cmake b/cmake/Modules/MacroLinkQtComponents.cmake index a6c80ce1e..c8a1c941f 100644 --- a/cmake/Modules/MacroLinkQtComponents.cmake +++ b/cmake/Modules/MacroLinkQtComponents.cmake @@ -5,11 +5,23 @@ macro (target_link_qt_components target) if (QT4_FOUND) foreach(_cmp ${ARGN}) - list(APPEND _QT_CMPNTS "Qt4::Qt${_cmp}") + if ("${_cmp}" STREQUAL "PRIVATE" OR + "${_cmp}" STREQUAL "PUBLIC" OR + "${_cmp}" STREQUAL "INTERFACE") + list(APPEND _QT_CMPNTS "${_cmp}") + else() + list(APPEND _QT_CMPNTS "Qt4::Qt${_cmp}") + endif() endforeach() else (QT4_FOUND) foreach(_cmp ${ARGN}) - list(APPEND _QT_CMPNTS "Qt5::${_cmp}") + if ("${_cmp}" STREQUAL "PRIVATE" OR + "${_cmp}" STREQUAL "PUBLIC" OR + "${_cmp}" STREQUAL "INTERFACE") + list(APPEND _QT_CMPNTS "${_cmp}") + else() + list(APPEND _QT_CMPNTS "Qt5::${_cmp}") + endif() endforeach() endif (QT4_FOUND) target_link_libraries(${target} ${_QT_CMPNTS}) diff --git a/src/base/CMakeLists.txt b/src/base/CMakeLists.txt index 7efcf4d2f..fa4ba824e 100644 --- a/src/base/CMakeLists.txt +++ b/src/base/CMakeLists.txt @@ -117,24 +117,24 @@ tristatebool.cpp ) add_library(qbt_base STATIC ${QBT_BASE_HEADERS} ${QBT_BASE_SOURCES}) -target_link_libraries(qbt_base ZLIB::ZLIB LibtorrentRasterbar::LibTorrent) -target_link_qt_components(qbt_base Core Network Xml) +target_link_libraries(qbt_base PRIVATE ZLIB::ZLIB PUBLIC LibtorrentRasterbar::LibTorrent) +target_link_qt_components(qbt_base PUBLIC Core Network Xml) if (QT4_FOUND) if (GUI) - target_link_libraries(qbt_base Qt4::QtGui) + target_link_libraries(qbt_base PUBLIC Qt4::QtGui) endif (GUI) else (QT4_FOUND) if (GUI) - target_link_libraries(qbt_base Qt5::Gui Qt5::Widgets) + target_link_libraries(qbt_base PUBLIC Qt5::Gui Qt5::Widgets) endif (GUI) endif (QT4_FOUND) if (DBUS) - target_link_qt_components(qbt_base DBus) + target_link_qt_components(qbt_base PRIVATE DBus) endif () if (APPLE) find_library(IOKit_LIBRARY IOKit) find_library(Carbon_LIBRARY Carbon) - target_link_libraries(qbt_base ${Carbon_LIBRARY} ${IOKit_LIBRARY}) + target_link_libraries(qbt_base PRIVATE ${Carbon_LIBRARY} ${IOKit_LIBRARY}) endif (APPLE)