From fa0b4cffc0f054c88b7dd477e693271d5b4d1055 Mon Sep 17 00:00:00 2001 From: Andreas Pokorny Date: Mon, 26 Aug 2024 13:20:26 +0200 Subject: [PATCH] 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. (cherry picked from commit d18fa929fbbf6d886e9122e1de948da94c29f54f) --- CMakeLists.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index af62675a..fba65b31 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( PROPERTIES CXX_VISIBILITY_PRESET hidden) +# # Todo # Test build for Windows, Mac and mingw. @@ -222,6 +226,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"