Skip to content

Commit

Permalink
Set USE_DEFAULT_VISIBILITY_HIDDEN to true
Browse files Browse the repository at this point in the history
Use new ign-cmake option to hide symbols not
explicitly marked as visible. This requires
adding target_sources calls to fix linking
errors in unit tests that use hidden symbols.

Signed-off-by: Steve Peters <[email protected]>
  • Loading branch information
scpeters committed Dec 16, 2021
1 parent e66d899 commit 3a37dc8
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 11 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ if (BUILD_SDF)

message (STATUS "----------------------------------------\n")

set(USE_DEFAULT_VISIBILITY_HIDDEN TRUE)
ign_configure_build(QUIT_IF_BUILD_ERRORS)
ign_create_packages()

Expand Down
48 changes: 37 additions & 11 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -48,32 +48,58 @@ if (BUILD_TESTING)
)
endif()

if (TARGET UNIT_XmlUtils_TEST)
target_link_libraries(UNIT_XmlUtils_TEST
TINYXML2::TINYXML2)
endif()

if (TARGET UNIT_Converter_TEST)
target_link_libraries(UNIT_Converter_TEST
TINYXML2::TINYXML2)
target_sources(UNIT_Converter_TEST PRIVATE
Converter.cc
EmbeddedSdf.cc
XmlUtils.cc)
endif()

if (TARGET UNIT_parser_urdf_TEST)
if (TARGET UNIT_FrameSemantics_TEST)
target_sources(UNIT_FrameSemantics_TEST PRIVATE FrameSemantics.cc)
endif()

if (TARGET UNIT_ParamPassing_TEST)
if (NOT USE_INTERNAL_URDF)
target_link_libraries(UNIT_parser_urdf_TEST
target_link_libraries(UNIT_ParamPassing_TEST
IgnURDFDOM::IgnURDFDOM)
endif()
target_link_libraries(UNIT_parser_urdf_TEST
target_link_libraries(UNIT_ParamPassing_TEST
TINYXML2::TINYXML2)
target_sources(UNIT_ParamPassing_TEST PRIVATE
Converter.cc
EmbeddedSdf.cc
FrameSemantics.cc
ParamPassing.cc
SDFExtension.cc
XmlUtils.cc
parser.cc
parser_urdf.cc)
endif()

if (TARGET UNIT_ParamPassing_TEST)
if (TARGET UNIT_Utils_TEST)
target_sources(UNIT_Utils_TEST PRIVATE Utils.cc)
endif()

if (TARGET UNIT_XmlUtils_TEST)
target_link_libraries(UNIT_XmlUtils_TEST
TINYXML2::TINYXML2)
target_sources(UNIT_XmlUtils_TEST PRIVATE XmlUtils.cc)
endif()

if (TARGET UNIT_parser_urdf_TEST)
if (NOT USE_INTERNAL_URDF)
target_link_libraries(UNIT_ParamPassing_TEST
target_link_libraries(UNIT_parser_urdf_TEST
IgnURDFDOM::IgnURDFDOM)
endif()
target_link_libraries(UNIT_ParamPassing_TEST
target_link_libraries(UNIT_parser_urdf_TEST
TINYXML2::TINYXML2)
target_sources(UNIT_parser_urdf_TEST PRIVATE
SDFExtension.cc
XmlUtils.cc
parser_urdf.cc)
endif()
endif()

Expand Down

0 comments on commit 3a37dc8

Please sign in to comment.