From c09df7b57c1e4b25b5e20c63d2bab63d0d12dea0 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Tue, 25 Aug 2020 08:17:23 +0200 Subject: CMake: Implement configure -reduce-exports This option maps to FEATURE_reduce_exports. The feature is on by default, except for MSVC. The reduce_exports configure test is not used in the CMake build. The _VISIBILITY_PRESET and VISIBILITY_INLINES_HIDDEN target properties are now explicitly initialized in the qt_set_common_target_properties function, because we don't have access to the feature in QtSetup.cmake where the CMAKE__VISIBILITY_PRESET variables were set before. Task-number: QTBUG-85373 Change-Id: I378453f0e0665731970016170302871e20ceb4e2 Reviewed-by: Qt CI Bot Reviewed-by: Alexandru Croitor --- cmake/QtTargetHelpers.cmake | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'cmake/QtTargetHelpers.cmake') diff --git a/cmake/QtTargetHelpers.cmake b/cmake/QtTargetHelpers.cmake index a78a02af98..d542eaafb8 100644 --- a/cmake/QtTargetHelpers.cmake +++ b/cmake/QtTargetHelpers.cmake @@ -175,6 +175,14 @@ endfunction() # Set target properties that are the same for all modules, plugins, executables # and 3rdparty libraries. function(qt_set_common_target_properties target) + if(QT_FEATURE_reduce_exports) + set_target_properties(${target} PROPERTIES + C_VISIBILITY_PRESET hidden + CXX_VISIBILITY_PRESET hidden + OBJC_VISIBILITY_PRESET hidden + OBJCXX_VISIBILITY_PRESET hidden + VISIBILITY_INLINES_HIDDEN 1) + endif() if(FEATURE_static_runtime) if(MSVC) set_property(TARGET ${target} PROPERTY -- cgit v1.2.3