CMake: Set hidden symbol visibility properties CMake caches the HAVE_VISIBILITY result, so disable it when build options change.
CMake: Set visibility properties in static builds Fixes #24378
Merge branch 'cmake-visibility' of https://github.com/MaartenBent/wxWidgets CMake: Set hidden symbol visibility properties. See #24635.
... | ... | @@ -111,6 +111,14 @@ function(wx_set_common_target_properties target_name) |
111 | 111 | set_target_properties(${target_name} PROPERTIES POSITION_INDEPENDENT_CODE TRUE)
|
112 | 112 | endif()
|
113 | 113 | |
114 | + if(NOT WIN32 AND wxUSE_VISIBILITY)
|
|
115 | + set_target_properties(${target_name} PROPERTIES
|
|
116 | + C_VISIBILITY_PRESET hidden
|
|
117 | + CXX_VISIBILITY_PRESET hidden
|
|
118 | + VISIBILITY_INLINES_HIDDEN TRUE
|
|
119 | + )
|
|
120 | + endif()
|
|
121 | + |
|
114 | 122 | if(MSVC)
|
115 | 123 | if(wxCOMMON_TARGET_PROPS_DEFAULT_WARNINGS)
|
116 | 124 | set(MSVC_WARNING_LEVEL "/W3")
|
... | ... | @@ -76,11 +76,11 @@ set(wxINSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}") |
76 | 76 | |
77 | 77 | check_include_files("stdlib.h;stdarg.h;string.h;float.h" STDC_HEADERS)
|
78 | 78 | |
79 | -if(wxBUILD_SHARED)
|
|
80 | - if(wxUSE_VISIBILITY)
|
|
81 | - check_cxx_compiler_flag(-fvisibility=hidden HAVE_VISIBILITY)
|
|
82 | - endif()
|
|
83 | -endif() # wxBUILD_SHARED
|
|
79 | +if(NOT WIN32 AND wxUSE_VISIBILITY)
|
|
80 | + check_cxx_compiler_flag(-fvisibility=hidden HAVE_VISIBILITY)
|
|
81 | +else()
|
|
82 | + set(HAVE_VISIBILITY 0)
|
|
83 | +endif()
|
|
84 | 84 | |
85 | 85 | if(MSVC)
|
86 | 86 | set(DISABLE_ALL_WARNINGS "/w")
|
—
View it on GitLab.
You're receiving this email because of your account on gitlab.com. Manage all notifications · Help