Browse Source

cmake: make LibtorrentRasterbar::LibTorrent public dependency of qbt_base

If libtorrent include directory not in the compiler search path, we have
to pass it to all qbt targets, because session.h includes
libtorrent/version.hpp
adaptive-webui-19844
Eugene Shalygin 8 years ago
parent
commit
13d9dea8ac
  1. 12
      cmake/Modules/MacroLinkQtComponents.cmake
  2. 12
      src/base/CMakeLists.txt

12
cmake/Modules/MacroLinkQtComponents.cmake

@ -5,11 +5,23 @@ @@ -5,11 +5,23 @@
macro (target_link_qt_components target)
if (QT4_FOUND)
foreach(_cmp ${ARGN})
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})
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})

12
src/base/CMakeLists.txt

@ -117,24 +117,24 @@ tristatebool.cpp @@ -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)

Loading…
Cancel
Save