Define `QT_STATICPLUGIN` when building static Qt plugins

This requirement is documented here:
https://doc.qt.io/qt-5/plugins-howto.html#creating-static-plugins
This commit is contained in:
Martchus 2021-09-16 18:36:35 +02:00
parent 030e6a2034
commit 9c9a47e551
1 changed files with 7 additions and 1 deletions

View File

@ -101,7 +101,7 @@ else ()
set(TARGET_INCLUDE_DIRECTORY_BUILD_INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}/..")
endif ()
# add target for building the library
# configure target type for building the library
if (BUILD_SHARED_LIBS)
if (META_IS_PLUGIN)
set(META_LIBRARY_TYPE MODULE)
@ -110,8 +110,14 @@ if (BUILD_SHARED_LIBS)
endif ()
else ()
set(META_LIBRARY_TYPE STATIC)
# define QT_STATICPLUGIN when building static Qt plugins
if ("${META_PROJECT_TYPE}" STREQUAL "qtplugin")
list(APPEND META_PRIVATE_COMPILE_DEFINITIONS QT_STATICPLUGIN)
endif ()
endif ()
# add custom libraries
append_user_defined_additional_libraries()