summaryrefslogtreecommitdiffstats
path: root/cmake/QtSetup.cmake
diff options
context:
space:
mode:
authorTor Arne Vestbø <tor.arne.vestbo@qt.io>2020-06-24 18:19:15 +0200
committerTor Arne Vestbø <tor.arne.vestbo@qt.io>2020-06-25 10:45:34 +0200
commit6d376ea5f409dcef54099b796dc5bc835fa51b7d (patch)
treee874ba5689b8a296a9f785585d5f1d883a568ff2 /cmake/QtSetup.cmake
parenta418fd5cbbf2d121c93d27194c02eb36aa4ac97e (diff)
cmake: Apply symbol visibility settings to Objective-C/C++ sources
Otherwise the Objective-C++ sources will be built with the default compiler visibility (visible), and then linked with moc-generated C++ sources that have the Qt overridden hidden visibility, resulting in linker warnings such as: ld: warning: direct access in function 'X' from file 'moc_foo.cpp.o' to global weak symbol 'Y' from file 'bar.mm.o' means the weak symbol cannot be overridden at runtime. This was likely caused by different translation units being compiled with different visibility setting Change-Id: I22e15e7e181a74de8c0a22c73d06e600e582d7fd Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'cmake/QtSetup.cmake')
-rw-r--r--cmake/QtSetup.cmake2
1 files changed, 2 insertions, 0 deletions
diff --git a/cmake/QtSetup.cmake b/cmake/QtSetup.cmake
index 607b3afebd..4bed289453 100644
--- a/cmake/QtSetup.cmake
+++ b/cmake/QtSetup.cmake
@@ -57,6 +57,8 @@ set(CMAKE_LINK_DEPENDS_NO_SHARED ON)
# Default to hidden visibility for symbols:
set(CMAKE_C_VISIBILITY_PRESET hidden)
set(CMAKE_CXX_VISIBILITY_PRESET hidden)
+set(CMAKE_OBJC_VISIBILITY_PRESET hidden)
+set(CMAKE_OBJCXX_VISIBILITY_PRESET hidden)
set(CMAKE_VISIBILITY_INLINES_HIDDEN 1)
# Detect non-prefix builds: either when the qtbase install prefix is set to the binary dir