File tree Expand file tree Collapse file tree 2 files changed +15
-0
lines changed Expand file tree Collapse file tree 2 files changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -128,6 +128,19 @@ macro(SEMMacroBuildCLI)
128128
129129 add_library (${CLP} Lib ${cli_library_type} ${${CLP} _SOURCE})
130130 set_target_properties (${CLP} Lib PROPERTIES COMPILE_FLAGS "-Dmain=ModuleEntryPoint" )
131+ if (NOT WIN32 AND NOT CYGWIN AND ${cli_library_type} STREQUAL "SHARED" )
132+ include (GenerateExportHeader)
133+ # The generated export header is not used, but this call is required to
134+ # define COMPILER_HAS_HIDDEN_VISIBILITY and USE_COMPILER_HIDDEN_VISIBILITY
135+ generate_export_header(${CLP} Lib)
136+ if (COMPILER_HAS_HIDDEN_VISIBILITY AND USE_COMPILER_HIDDEN_VISIBILITY)
137+ set_property (TARGET ${CLP} Lib
138+ APPEND_STRING PROPERTY COMPILE_FLAGS " -DMODULE_HIDDEN_VISIBILITY" )
139+ set_target_properties (${CLP} Lib PROPERTIES CXX_VISIBILITY_PRESET hidden)
140+ set_target_properties (${CLP} Lib PROPERTIES C_VISIBILITY_PRESET hidden)
141+ set_target_properties (${CLP} Lib PROPERTIES VISIBILITY_INLINES_HIDDEN 1)
142+ endif ()
143+ endif ()
131144 if (DEFINED LOCAL_SEM_TARGET_LIBRARIES)
132145 target_link_libraries (${CLP} Lib ${LOCAL_SEM_TARGET_LIBRARIES} )
133146 endif ()
Original file line number Diff line number Diff line change @@ -666,6 +666,8 @@ void GenerateExports(std::ostream &sout)
666666{
667667 sout << " #ifdef _WIN32" << std::endl;
668668 sout << " #define Module_EXPORT __declspec(dllexport)" << std::endl;
669+ sout << " #elif defined(MODULE_HIDDEN_VISIBILITY)" << std::endl;
670+ sout << " #define Module_EXPORT __attribute__((visibility(\" default\" )))" << std::endl;
669671 sout << " #else" << std::endl;
670672 sout << " #define Module_EXPORT" << std::endl;
671673 sout << " #endif" << std::endl;
You can’t perform that action at this time.
0 commit comments