<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 14 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri","sans-serif";}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="blue" vlink="purple">
<!--ppd47--><!--ppd53--><!--ppd48-->
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">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.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<br>
<br>
<span id="ppe_48">
<div align="left">
<p style="align: left">
<table border="0" cellspacing="0" cellpadding="2" width="460">
<tbody>
<tr>
<td colspan="2"><img src="http://download2.nikon.net/images/logo/grey_div.gif" width="408" height="6"></td>
</tr>
<tr>
<td valign="top" width="106"><img src="http://download2.nikon.net/images/logo/bsymbol.gif" width="106" height="108"></td>
<td valign="top">
<table border="0" cellspacing="0" cellpadding="1" width="440">
<tbody>
<tr valign="top">
<td colspan="2"><strong><font size="1" face="Verdana, Arial, Helvetica, sans-serif">Khouri Giordano</font></strong></td>
</tr>
<tr valign="top">
<td colspan="2"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">Software Technology Researcher</font></td>
</tr>
<tr>
<td colspan="2"><font size="1"><img src="http://download2.nikon.net/images/logo/spacer.gif" width="15" height="4"></font></td>
</tr>
<tr>
<td colspan="2"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">Nikon Inc.</font></td>
</tr>
<tr>
<td colspan="2"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">1300 Walt Whitman Road</font></td>
</tr>
<tr>
<td colspan="2"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">Melville NY 11747-3064</font></td>
</tr>
<tr>
<td colspan="2"><font size="1" face="Verdana, Arial, Helvetica, sans-serif"></font></td>
</tr>
<tr>
<td width="150"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">Office: 631-547-4335</font></td>
<td><font size="1" face="Verdana, Arial, Helvetica, sans-serif">Fax: 631-547-0361</font></td>
</tr>
<tr>
<td><font size="1" face="Verdana, Arial, Helvetica, sans-serif"></font></td>
<td><font size="1" face="Verdana, Arial, Helvetica, sans-serif"></font></td>
</tr>
<tr>
<td><font size="1" face="Verdana, Arial, Helvetica, sans-serif"><a href="mailto:kgiordano@nikon.net">kgiordano@nikon.net</a></font></td>
<td>
<p></p>
<p> </p>
</td>
</tr>
<tr>
<td>
<p><font size="1" face="Verdana, Arial, Helvetica, sans-serif"><a href="www.nikonusa.com">www.nikonusa.com</a></font></p>
</td>
<td> </td>
</tr>
</tbody>
</table>
<p><font size="1"></font> </p>
</td>
</tr>
</tbody>
</table>
</p>
</div>
</span><br>
<br>
<span id="ppe_53"><a href="http://www.nikonusa.com/en/Nikon-Products/Product/Nikon1/V27669.27669/Nikon-1-AW1.html?cid=eml-0913-n1aw1-signature" target="_blank"><img border="0" src="http://download2.nikon.net/images/logo/nikon1AW1sig.jpg">
</a></span>
<div style="border:none;border-left:solid blue 1.5pt;padding:0in 0in 0in 4.0pt">
<div>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">From:</span></b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif""> cmake-bounces@cmake.org [mailto:cmake-bounces@cmake.org]
<b>On Behalf Of </b>James Bigler<br>
<b>Sent:</b> Wednesday, October 16, 2013 2:06 PM<br>
<b>To:</b> cmake@cmake.org<br>
<b>Subject:</b> [CMake] Transitive linking and static libraries<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p class="MsoNormal">Is it possible to stop known static libraries from being carried through shared libraries?<o:p></o:p></p>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">add_library(mystatic1 STATIC ...)<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">add_library(mystatic2 STATIC ...)<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">add_library(myshared SHARED ...)<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">target_link_libraries(myshared mystatic1 mystatic2)<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">add_executable(myexe)<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">target_link_libraries(myexe myshared)<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">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.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">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.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">James<o:p></o:p></p>
</div>
</div>
</div>
</div>
<br>
<br>
<span id="ppe_47">
<div align="left">
<p><u><span style="FONT-SIZE: 7.5pt">CONFIDENTIAL:</span></u><span style="FONT-SIZE: 7.5pt"><br>
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.</span></p>
<p><span style="FONT-SIZE: 7.5pt"></span><span style="FONT-SIZE: 10pt"><O:P></O:P></span></p>
</div>
</span>
</body>
</html>