rm5248 commented on issue #22: Only exporting the log4cxx symbols by default URL: https://github.com/apache/logging-log4cxx/pull/22#issuecomment-612049860 In that case, there's probably an easier way to do this. Since the symbols already need to be marked as exported for Windows builds, they already have a `LOG4CXX_EXPORT` macro associated with them. This is not set to anything on [Linux/OSX builds](https://github.com/apache/logging-log4cxx/blob/671f0b5663b6b1063cfaa44acaee1b244fec3769/src/main/include/log4cxx/log4cxx.h.in#L46), but since the macro is there all you _should_ have to do is modify log4cxx.hw.in to look something like the following: ``` #define LOG4CXX_EXPORT_SYMBOLS_ONLY @EXPORT_ONLY_LOG4CXX_SYMBOLS@ #if LOG4CXX_EXPORT_SYMBOLS_ONLY #if __GNUC__ >= 4 #define LOG4CXX_EXPORT __attribute__((visibility("default"))) #else #define LOG4CXX_EXPORT #endif #else #define LOG4CXX_EXPORT #endif ``` And then add to the compilation flags `-fvisibility=internal`, something like this: ``` if(BUILD_SHARED_LIBS AND EXPORT_ONLY_LOG4CXX_SYMBOLS) check_cxx_compiler_flag("-fvisibility=internal" LOG4CXX_SUPPORTS_VISIBILITY_INTERNAL) if( LOG4CXX_SUPPORTS_VISIBILITY_INTERNAL ) set( LOG4CXX_COMPILE_OPTIONS ${LOG4CXX_COMPILE_OPTIONS} "-fvisibility=internal") endif( LOG4CXX_SUPPORTS_VISIBILITY_INTERNAL ) endif() # ... in src/CMakeLists.txt target_link_libraries(log4cxx PRIVATE ${LOG4CXX_COMPILE_OPTIONS}) ``` Weather or not that will work appropriately/is a good idea I don't know.
---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected] With regards, Apache Git Services
