summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Pokorny <andreas.pokorny@gmail.com>2024-08-26 13:20:26 +0200
committerAndreas Pokorny <andreas.pokorny@gmail.com>2024-08-26 13:20:51 +0200
commitd18fa929fbbf6d886e9122e1de948da94c29f54f (patch)
tree1e33df9d4179df47f3b2037672e834f4c066dc0a
parent19c83a8837738e5014cc35771820bcb8cb73a5ea (diff)
downloadredot-cpp-d18fa929fbbf6d886e9122e1de948da94c29f54f.tar.gz
Add visibility-hidden
This should make all symbols that are not marked otherwise have hidden visibility. There still may be exposed symbols if marked with respective attributes.
-rw-r--r--CMakeLists.txt5
1 files changed, 5 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 9609061..fac22fd 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -35,6 +35,10 @@
# Generate the buildfiles in a sub directory to not clutter the root directory with build files:
# mkdir build && cd build && cmake -G "Unix Makefiles" .. && cmake --build .
#
+# Ensure that you avoid exposing godot-cpp symbols - this might lead to hard to debug errors if you ever load multiple
+# plugins using difference godot-cpp versions. Use visibility hidden whenever possible:
+# set_target_properties(<all-my-plugin-related-targets> PROPERTIES CXX_VISIBILITY_PRESET hidden)
+#
# Todo
# Test build for Windows, Mac and mingw.
@@ -221,6 +225,7 @@ set_target_properties(${PROJECT_NAME}
PROPERTIES
CXX_EXTENSIONS OFF
POSITION_INDEPENDENT_CODE ON
+ CXX_VISIBILITY_PRESET hidden
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/bin"
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/bin"
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/bin"