mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-08-21 05:43:32 -07: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:
parent
fd156580a0
commit
b137eb01ed
6 changed files with 38 additions and 11 deletions
17
cmake/Modules/QbtTargetSources.cmake
Normal file
17
cmake/Modules/QbtTargetSources.cmake
Normal file
|
@ -0,0 +1,17 @@
|
|||
# a helper function which appends source to the main qBt target
|
||||
# the target name is read from QBT_TARGET_NAME variable
|
||||
# sources file names are relative to the the ${qbt_executable_SOURCE_DIR}
|
||||
|
||||
function (qbt_target_sources)
|
||||
set (_sources_rel "")
|
||||
foreach (_source IN ITEMS ${ARGN})
|
||||
if (IS_ABSOLUTE "${_source}")
|
||||
set(source_abs "${_source}")
|
||||
else()
|
||||
get_filename_component(_source_abs "${_source}" ABSOLUTE)
|
||||
endif()
|
||||
file (RELATIVE_PATH _source_rel "${qbt_executable_SOURCE_DIR}" "${_source_abs}")
|
||||
list (APPEND _sources_rel "${_source_rel}")
|
||||
endforeach()
|
||||
target_sources (${QBT_TARGET_NAME} PRIVATE "${_sources_rel}")
|
||||
endfunction (qbt_target_sources)
|
Loading…
Add table
Add a link
Reference in a new issue