diff --git a/cmake/utilities.cmake b/cmake/utilities.cmake index d11dde6f66..7760a703c7 100644 --- a/cmake/utilities.cmake +++ b/cmake/utilities.cmake @@ -308,7 +308,15 @@ function(add_gambit_executable executablename LIBRARIES) cmake_parse_arguments(ARG "" "" "SOURCES;HEADERS;" ${ARGN}) add_executable(${executablename} ${ARG_SOURCES} ${ARG_HEADERS}) - set_target_properties(${executablename} PROPERTIES EXCLUDE_FROM_ALL 1) + # ENABLE_EXPORTS adds -rdynamic/-export_dynamic to the linker so that dlopen'd backends + # and scanner plugins can resolve symbols from statically linked contrib libraries (e.g. + # yaml-cpp exception typeinfo). Setting this via a target property rather than + # CMAKE_CXX_FLAGS keeps GAMBIT's own code compiled with -fvisibility=hidden, so only + # contrib symbols built with default visibility are exported, not GAMBIT internals. + set_target_properties(${executablename} PROPERTIES + EXCLUDE_FROM_ALL 1 + ENABLE_EXPORTS TRUE + ) if(${CMAKE_VERSION} VERSION_GREATER 2.8.10) foreach (dir ${GAMBIT_INCDIRS}) diff --git a/contrib/yaml-cpp-0.6.2/CMakeLists.txt b/contrib/yaml-cpp-0.6.2/CMakeLists.txt index 91fd7f16af..05d7f87144 100755 --- a/contrib/yaml-cpp-0.6.2/CMakeLists.txt +++ b/contrib/yaml-cpp-0.6.2/CMakeLists.txt @@ -51,4 +51,6 @@ endif() set_target_properties(yaml-cpp PROPERTIES ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" + CXX_VISIBILITY_PRESET default + VISIBILITY_INLINES_HIDDEN FALSE )