CMake: Qt Creator Static build support

This adds the build system feature that allows Qt Creator's libraries
and plugins to be compiled statically.

Fixes some symbol clashes when all plugins are linked into the same
executable.

Support for actually loading static plugins will be added in a separate
commit.

The feature is controlled by QTC_STATIC_BUILD which by default is OFF.

Change-Id: I1fab7953c43e42dc75619e35660029ee067106df
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
This commit is contained in:
Cristian Adam
2022-04-21 14:10:09 +02:00
parent 58b0a5056c
commit 88781a003f
88 changed files with 330 additions and 132 deletions

View File

@@ -1,10 +1,7 @@
# TODO: Support static build, currently being done with CPLUSPLUS_BUILD_STATIC_LIB
# -- if really needed that is.
# TODO: Make Qt5::Gui optional -- if really needed that is.
add_qtc_library(CPlusPlus
DEPENDS Utils Qt5::Concurrent
DEFINES CPLUSPLUS_BUILD_LIB
PUBLIC_DEPENDS 3rd_cplusplus Qt5::Gui
SOURCES
ASTParent.cpp ASTParent.h
@@ -43,6 +40,12 @@ add_qtc_library(CPlusPlus
SKIP_PCH
)
set(export_symbol_declaration DEFINES CPLUSPLUS_BUILD_LIB)
if (QTC_STATIC_BUILD)
set(export_symbol_declaration PUBLIC_DEFINES CPLUSPLUS_BUILD_STATIC_LIB)
endif()
extend_qtc_target(CPlusPlus ${export_symbol_declaration})
if(TARGET CPlusPlus)
qtc_enable_release_for_debug_configuration()
if (BUILD_WITH_PCH)