godot-cpp
godot-cpp copied to clipboard
Add visibility-hidden to CMake build
This should make all symbols that are not marked otherwise have hidden visibility. There still may be exposed symbols if marked with respective attributes.
This is to avoid symbol clashes when multiple versions of godot-cpp are loaded through different plugins. Scons seems to do something similar already,
Thanks!
With scons, visibility hidden is the default, but there is an option to change it. Would it be possible to add an option for cmake as well?
You can change the behavior later - even in downstream projects via set_target_properties(<targets...> PROPERTIES CXX_VISIBILITY_PRESET default )
I think this should be merged. Even though we're aiming for feature and interface parity, even without the option displayed it still adds something missing from the cmake build that is in the scons one. Perfect is the enemy of the good and all. it's trivial to add a cache entry which will show up in 'cmake -LH'
Ok, let's merge this and then add an option in a follow-up
Cherry-picked for 4.2 in PR https://github.com/godotengine/godot-cpp/pull/1631
Cherry-picked for 4.3 in PR https://github.com/godotengine/godot-cpp/pull/1632