Fix Linux plugin template build visibility (#58069)

The CMake plugin build wasn't setting visibility to hidden by default,
which meant that plugins exported everything by default. This would make
bad interactions between plugins much more likely; only the intended API
should be exported by the shared library.
This commit is contained in:
stuartmorgan 2020-05-27 10:55:34 -07:00 committed by GitHub
parent 8b63c65436
commit 27e652c882
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 0 deletions

View File

@ -3,6 +3,8 @@ project(runner LANGUAGES CXX)
set(BINARY_NAME "{{projectName}}")
cmake_policy(SET CMP0063 NEW)
set(CMAKE_INSTALL_RPATH "\$ORIGIN")
# Configure build options.

View File

@ -65,6 +65,8 @@ add_library(flutter_wrapper_plugin STATIC
apply_standard_settings(flutter_wrapper_plugin)
set_target_properties(flutter_wrapper_plugin PROPERTIES
POSITION_INDEPENDENT_CODE ON)
set_target_properties(flutter_wrapper_plugin PROPERTIES
CXX_VISIBILITY_PRESET hidden)
target_link_libraries(flutter_wrapper_plugin PUBLIC flutter)
target_include_directories(flutter_wrapper_plugin PUBLIC
"${WRAPPER_ROOT}/include"

View File

@ -8,6 +8,9 @@ add_library(${PLUGIN_NAME} SHARED
"${PLUGIN_NAME}.cc"
)
apply_standard_settings(${PLUGIN_NAME})
set_target_properties(${PLUGIN_NAME} PROPERTIES
CXX_VISIBILITY_PRESET hidden)
target_compile_definitions(${PLUGIN_NAME} PRIVATE FLUTTER_PLUGIN_IMPL)
target_include_directories(${PLUGIN_NAME} INTERFACE
"${CMAKE_CURRENT_SOURCE_DIR}/include")
target_link_libraries(${PLUGIN_NAME} PRIVATE flutter flutter_wrapper_plugin)