CMake: Fix static build with a reduce number of plugins

This changeset allows building Qt Creator statically with a reduced number
of plugins, especially without QmlDesigner.

Change-Id: I0050c72d3959fe43edae60bd47ecab9c0ee544b3
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
Cristian Adam
2022-05-02 17:49:23 +02:00
parent 27fddc8dc7
commit 15611ee822
3 changed files with 9 additions and 2 deletions

View File

@@ -37,7 +37,7 @@ extend_qtc_plugin(Designer
SOURCES gotoslot_test.cpp SOURCES gotoslot_test.cpp
) )
if (QTC_STATIC_BUILD) if (QTC_STATIC_BUILD AND TARGET Designer)
get_target_property(_designerType Qt5::Designer TYPE) get_target_property(_designerType Qt5::Designer TYPE)
if (${_designerType} STREQUAL "STATIC_LIBRARY") if (${_designerType} STREQUAL "STATIC_LIBRARY")
extend_qtc_target(Designer PUBLIC_DEFINES QT_DESIGNER_STATIC) extend_qtc_target(Designer PUBLIC_DEFINES QT_DESIGNER_STATIC)

View File

@@ -58,7 +58,7 @@ add_qtc_plugin(QmlDesigner
include(qmldesignercore.cmake) include(qmldesignercore.cmake)
extend_with_qmldesigner_core(QmlDesigner) extend_with_qmldesigner_core(QmlDesigner)
if (QTC_STATIC_BUILD) if (QTC_STATIC_BUILD AND TARGET QmlDesigner)
get_target_property(_designerType Qt5::Designer TYPE) get_target_property(_designerType Qt5::Designer TYPE)
if (${_designerType} STREQUAL "STATIC_LIBRARY") if (${_designerType} STREQUAL "STATIC_LIBRARY")
extend_qtc_target(QmlDesigner PUBLIC_DEFINES QT_DESIGNER_STATIC) extend_qtc_target(QmlDesigner PUBLIC_DEFINES QT_DESIGNER_STATIC)

View File

@@ -12,3 +12,10 @@ add_qtc_library(designerintegrationv2 STATIC
widgethostconstants.h widgethostconstants.h
widgethost.cpp widgethost.h widgethost.cpp widgethost.h
) )
if (QTC_STATIC_BUILD)
get_target_property(_designerType Qt5::Designer TYPE)
if (${_designerType} STREQUAL "STATIC_LIBRARY")
extend_qtc_target(designerintegrationv2 PUBLIC_DEFINES QT_DESIGNER_STATIC)
endif()
endif()