The static libraries must be compiled with -fvisibility=hidden. Symbols with default visibility are marked as "public" and will leak from a shared library. With hidden visibility, they symbols are marked as "private extern", allowing you to link with them, but not allowing them to leak from a shared library. Any time that shared libraries are involved, you will want hidden visibility and mark your public API functions with default visibility.
[http://download2.nikon.net/images/logo/bsymbol.gif] Khouri Giordano Software Technology Researcher Nikon Inc. 1300 Walt Whitman Road Melville NY 11747-3064 Office: 631-547-4335 Fax: 631-547-0361 [email protected]<mailto:[email protected]> www.nikonusa.com [http://download2.nikon.net/images/logo/nikon1AW1sig.jpg] <http://www.nikonusa.com/en/Nikon-Products/Product/Nikon1/V27669.27669/Nikon-1-AW1.html?cid=eml-0913-n1aw1-signature> From: [email protected] [mailto:[email protected]] On Behalf Of James Bigler Sent: Wednesday, October 16, 2013 2:06 PM To: [email protected] Subject: [CMake] Transitive linking and static libraries Is it possible to stop known static libraries from being carried through shared libraries? add_library(mystatic1 STATIC ...) add_library(mystatic2 STATIC ...) add_library(myshared SHARED ...) target_link_libraries(myshared mystatic1 mystatic2) add_executable(myexe) target_link_libraries(myexe myshared) Once a shared library is created, all the information about what libraries are needed should be encoded in the shared library. In addition if myexe links against only myshared then only the symbols being exported by myshared should be visible to myexe. I'm seeing problems where symbols from mystatic1 are being seen by myexe, when myexe should only be seeing symbols from myshared. This is because CMake links myshared, mystatic1, and mystatic2 to myexe all in the same link line. James CONFIDENTIAL: This e-mail including any attachments is intended only for the party or parties to whom it is addressed and may contain information which is privileged and/or confidential. If you are not the intended recipient, you are hereby notified that any use, disclosure, dissemination, distribution, copying, or printing of any information contained in or attached to this e-mail is STRICTLY PROHIBITED and may constitute a breach of confidentiality and/or privilege. If you have received this e-mail in error, please notify immediately the sender by reply e-mail and then delete this e-mail and any attachments in their entirety from your system. Thank you. This e-mail message including any attachments is believed to be free of any viruses; however, it is the sole responsibility of the recipient to ensure that it is virus free, and Nikon does not accept any responsibility for any loss, disruption or damage to your data or computer system which may occur in connection with this e-mail including any attachments.
-- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
