Skip to content

Commit

Permalink
cmake: Use TYPE property to tell Qt libraries type
Browse files Browse the repository at this point in the history
  • Loading branch information
hebasto committed Jul 2, 2024
1 parent 69afb91 commit 2296161
Showing 1 changed file with 4 additions and 17 deletions.
21 changes: 4 additions & 17 deletions src/qt/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
string(APPEND CMAKE_OBJCXX_COMPILE_OBJECT " ${APPEND_CPPFLAGS} ${APPEND_CXXFLAGS}")
endif()

get_target_property(qt_lib_type Qt5::Core TYPE)

function(import_plugins target)
if(QT_IS_STATIC)
if(qt_lib_type STREQUAL "STATIC_LIBRARY")
set(plugins Qt5::QMinimalIntegrationPlugin)
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
list(APPEND plugins Qt5::QXcbIntegrationPlugin)
Expand All @@ -37,21 +39,6 @@ set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTOUIC_SEARCH_PATHS forms)

include(CMakePushCheckState)
cmake_push_check_state(RESET)
set(CMAKE_REQUIRED_LIBRARIES Qt5::Core)
include(CheckCXXSourceCompiles)
check_cxx_source_compiles("
#include <QtGlobal>
#if !defined(QT_STATIC)
#error Qt is not static
#endif
int main() {}
" QT_IS_STATIC
)
cmake_pop_check_state()

# TODO: The file(GLOB ...) command should be replaced with an explicit
# file list. Such a change must be synced with the corresponding change
# to https://github.com/bitcoin-core/bitcoin-maintainer-tools/blob/main/update-translations.py
Expand Down Expand Up @@ -229,7 +216,7 @@ if(WITH_DBUS)
target_link_libraries(bitcoinqt PRIVATE Qt5::DBus)
endif()

if(QT_IS_STATIC)
if(qt_lib_type STREQUAL "STATIC_LIBRARY")
# We want to define static plugins to link ourselves, thus preventing
# automatic linking against a "sane" set of default static plugins.
qt5_import_plugins(bitcoinqt
Expand Down

0 comments on commit 2296161

Please sign in to comment.