mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2025-12-20 23:47:23 -06:00
cmake: fix Qt resources linkage. Closes #5080
Qt resource is innitialized by a static object constructor (see https://wiki.qt.io/QtResources). When we put resources into a static library, the linker removes that static objects and thus the resources themselves. To correct that we append resources to the main executable sources list. This is done via custom function qbt_target_sources which knows where to read the executable' name.
This commit is contained in:
@@ -8,6 +8,7 @@ add_subdirectory(properties)
|
||||
add_subdirectory(powermanagement)
|
||||
add_subdirectory(rss)
|
||||
add_subdirectory(search)
|
||||
|
||||
if (UNIX AND NOT APPLE AND DBUS)
|
||||
add_subdirectory(qtnotify)
|
||||
include_directories(qtnotify)
|
||||
@@ -127,7 +128,7 @@ options.ui
|
||||
torrentcreatordlg.ui
|
||||
)
|
||||
|
||||
set(QBT_GUI_RESOURCES about.qrc)
|
||||
qbt_target_sources(about.qrc)
|
||||
|
||||
add_library(qbt_gui STATIC ${QBT_GUI_HEADERS} ${QBT_GUI_SOURCES} ${QBT_GUI_RESOURCES})
|
||||
add_library(qbt_gui STATIC ${QBT_GUI_HEADERS} ${QBT_GUI_SOURCES})
|
||||
target_link_libraries(qbt_gui qbt_lineedit qbt_powermanagement qbt_rss qbt_properties qbt_searchengine ${QBT_GUI_OPTIONAL_LINK_LIBRARIES} qbt_base)
|
||||
|
||||
@@ -10,9 +10,11 @@ set(QBT_LINEEDIT_RESOURCES
|
||||
resources/lineeditimages.qrc
|
||||
)
|
||||
|
||||
add_library(qbt_lineedit STATIC ${QBT_LINEEDIT_SOURCES} ${QBT_LINEEDIT_HEADERS} ${QBT_LINEEDIT_RESOURCES})
|
||||
add_library(qbt_lineedit STATIC ${QBT_LINEEDIT_SOURCES} ${QBT_LINEEDIT_HEADERS})
|
||||
if (QT4_FOUND)
|
||||
target_link_libraries(qbt_lineedit Qt4::QtGui)
|
||||
else (QT4_FOUND)
|
||||
target_link_libraries(qbt_lineedit Qt5::Widgets)
|
||||
endif (QT4_FOUND)
|
||||
|
||||
qbt_target_sources(${QBT_LINEEDIT_RESOURCES})
|
||||
|
||||
Reference in New Issue
Block a user