Skip to content

Commit 02bdc66

Browse files
committed
Add GODOT_SYMBOL_VISIBILITY cache variable to match scons interface.
1 parent aed9b5c commit 02bdc66

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

Diff for: CMakeLists.txt

+13-1
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,18 @@ option(GENERATE_TEMPLATE_GET_NODE "Generate a template version of the Node class
4949
option(GODOT_CPP_SYSTEM_HEADERS "Expose headers as SYSTEM." ON)
5050
option(GODOT_CPP_WARNING_AS_ERROR "Treat warnings as errors" OFF)
5151

52+
set( GODOT_SYMBOL_VISIBILITY "hidden" CACHE STRING "Symbols visibility on GNU platforms. Use 'auto' to apply the default value. (auto|visible|hidden)")
53+
set_property( CACHE GODOT_SYMBOL_VISIBILITY PROPERTY STRINGS "auto;visible;hidden" )
54+
55+
# CXX_VISIBILITY_PRESET supported values are: default, hidden, protected, and internal
56+
# which is inline with the gcc -fvisibility=
57+
# https://gcc.gnu.org/onlinedocs/gcc/Code-Gen-Options.html
58+
# To match the scons options we need to change the text to match the -fvisibility flag
59+
# it is probably worth another PR which changes both to use the flag options
60+
if( ${GODOT_SYMBOL_VISIBILITY} STREQUAL "auto" OR ${GODOT_SYMBOL_VISIBILITY} STREQUAL "visible" )
61+
set( GODOT_SYMBOL_VISIBILITY "default" )
62+
endif ()
63+
5264
# Add path to modules
5365
list( APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/" )
5466

@@ -226,7 +238,7 @@ set_target_properties(${PROJECT_NAME}
226238
PROPERTIES
227239
CXX_EXTENSIONS OFF
228240
POSITION_INDEPENDENT_CODE ON
229-
CXX_VISIBILITY_PRESET hidden
241+
CXX_VISIBILITY_PRESET ${GODOT_SYMBOL_VISIBILITY}
230242
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/bin"
231243
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/bin"
232244
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/bin"

0 commit comments

Comments
 (0)