Skip to content

Commit

Permalink
Use visibility hidden by default
Browse files Browse the repository at this point in the history
Signed-off-by: Jose Luis Rivero <[email protected]>
  • Loading branch information
j-rivero committed Oct 26, 2023
1 parent 9426b82 commit 64a3a57
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
10 changes: 8 additions & 2 deletions cmake/GzConfigureBuild.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,22 @@
#################################################
# Configure the build of the Gazebo project
# Pass the argument HIDE_SYMBOLS_BY_DEFAULT to configure symbol visibility so
# that symbols are hidden unless explicitly marked as visible.
# that symbols are hidden unless explicitly marked as visible. (DEPRECATED)
# Pass the argument EXPOSE_SYMBOLS_BY_DEFAULT to configure symbol visibility
# so symbols are exposed unless explicitly marked as hidden.
# Pass the argument QUIT_IF_BUILD_ERRORS to have this macro quit cmake when the
# build_errors
macro(gz_configure_build)
# Parse the arguments that are passed in
set(options HIDE_SYMBOLS_BY_DEFAULT QUIT_IF_BUILD_ERRORS)
set(options HIDE_SYMBOLS_BY_DEFAULT EXPOSE_SYMBOLS_BY_DEFAULT QUIT_IF_BUILD_ERRORS)
set(oneValueArgs)
set(multiValueArgs COMPONENTS)
cmake_parse_arguments(gz_configure_build "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})

if(gz_configure_build_HIDE_SYMBOLS_BY_DEFAULT)
message(DEPRECATION "HIDE_SYMBOLS_BY_DEFAULT is now the default. You can safely remove the option.")
endif()

#============================================================================
# Examine the build type. If we do not recognize the type, we will generate
# an error, so this must come before the error handling.
Expand Down
8 changes: 4 additions & 4 deletions cmake/GzSetCompilerFlags.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -123,12 +123,12 @@ endmacro()
# Internal to gz-cmake.
macro(_gz_setup_gcc_or_clang)

if(gz_configure_build_HIDE_SYMBOLS_BY_DEFAULT)
set(CMAKE_C_VISIBILITY_PRESET "hidden")
set(CMAKE_CXX_VISIBILITY_PRESET "hidden")
else()
if(gz_configure_build_EXPOSE_SYMBOLS_BY_DEFAULT)
set(CMAKE_C_VISIBILITY_PRESET "default")
set(CMAKE_CXX_VISIBILITY_PRESET "default")
else()
set(CMAKE_C_VISIBILITY_PRESET "hidden")
set(CMAKE_CXX_VISIBILITY_PRESET "hidden")
endif()


Expand Down

0 comments on commit 64a3a57

Please sign in to comment.