Do not generate cpp exports for pure STATIC modules

Static libraries don't need to export their symbols, and corner cases
when sources are also used in shared libraries, should be handled
manually.

Task-number: QTBUG-90492
Change-Id: I5cb0a3f7e280b042b678bdbe4475f2bbf9f6b9ba
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This commit is contained in:
Alexey Edelev 2021-09-16 19:15:05 +02:00
parent f16c8fdf18
commit 2f1d6e4c3f

View File

@ -312,7 +312,10 @@ function(qt_internal_add_module target)
set_property(TARGET ${target} APPEND PROPERTY
_qt_module_timestamp_dependencies "${module_headers_public}")
if(arg_GENERATE_CPP_EXPORTS)
# We should not generate export headers if module is defined as pure STATIC.
# Static libraries don't need to export their symbols, and corner cases when sources are
# also used in shared libraries, should be handled manually.
if(arg_GENERATE_CPP_EXPORTS AND NOT arg_STATIC)
if(arg_CPP_EXPORT_HEADER_BASE_NAME)
set(cpp_export_header_base_name
"CPP_EXPORT_HEADER_BASE_NAME;${arg_CPP_EXPORT_HEADER_BASE_NAME}"