CMake: Add functions to allow setting symbol visibility flags

Needed for 3rd party library code.

Change-Id: Ib994de1980515e849d4368249024d3d5e064fb46
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
bb10
Alexandru Croitor 2020-02-24 12:38:55 +01:00
parent 05a0a278fc
commit 5838d1f6c3
1 changed files with 14 additions and 0 deletions

View File

@ -1431,6 +1431,20 @@ function(qt_disable_warnings target)
set_target_properties("${target}" PROPERTIES QT_COMPILE_OPTIONS_DISABLE_WARNINGS ON)
endfunction()
function(qt_set_symbol_visibility_preset target value)
get_target_property(target_type "${target}" TYPE)
if(target_type STREQUAL "INTERFACE_LIBRARY")
return()
endif()
set_target_properties("${target}" PROPERTIES C_VISIBILITY_PRESET "${value}")
set_target_properties("${target}" PROPERTIES CXX_VISIBILITY_PRESET "${value}")
endfunction()
function(qt_set_symbol_visibility_hidden target)
qt_set_symbol_visibility_preset("${target}" "hidden")
endfunction()
function(qt_get_sanitized_plugin_type plugin_type out_var)
# Used to handle some edge cases such as platforms/darwin
string(REGEX REPLACE "[-/]" "_" plugin_type "${plugin_type}")