<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 15 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:#0563C1;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:#954F72;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
.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="#0563C1" vlink="#954F72"><div class=WordSection1><p class=MsoNormal><span style='font-size:12.0pt'>Hi folks,<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:12.0pt'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:12.0pt'>The P4 programming language has a compiler called p4c with a variant in p4c-xp.  This compiler executable is built on Ubuntu 16.04.   p4c-xp uses cmake.  As one can see, there are several shared libs used by p4c-xp.  Each shared lib may call other shared libs.  I could use some help with cmake.  I have used some cmake help for creating a single static lib but the steps did not help on Ubuntu.  Further, I would like cmake to automatically detect other shared lib dependencies and build a statically linked executable.<o:p></o:p></span></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><span style='font-family:"Courier New",serif'>$ <span style='background:yellow;mso-highlight:yellow'>ldd p4c-xp</span><o:p></o:p></span></p><p class=MsoNormal><span style='font-family:"Courier New",serif'>     linux-vdso.so.1 =>  (0x00007ffd2cd06000)<o:p></o:p></span></p><p class=MsoNormal><span style='font-family:"Courier New",serif'>     libboost_iostreams.so.1.58.0 => /usr/lib/x86_64-linux-gnu/libboost_iostreams.so.1.58.0 (0x00007f0efa732000)<o:p></o:p></span></p><p class=MsoNormal><span style='font-family:"Courier New",serif'>     libgmp.so.10 => /usr/local/lib/libgmp.so.10 (0x00007f0efa4bb000)<o:p></o:p></span></p><p class=MsoNormal><span style='font-family:"Courier New",serif'>     libgmpxx.so.4 => /usr/lib/x86_64-linux-gnu/libgmpxx.so.4 (0x00007f0efa2b5000)<o:p></o:p></span></p><p class=MsoNormal><span style='font-family:"Courier New",serif'>     libgc.so.1 => /usr/local/lib/libgc.so.1 (0x00007f0efa048000)<o:p></o:p></span></p><p class=MsoNormal><span style='font-family:"Courier New",serif'>     librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f0ef9e40000)<o:p></o:p></span></p><p class=MsoNormal><span style='font-family:"Courier New",serif'>     libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f0ef9abe000)<o:p></o:p></span></p><p class=MsoNormal><span style='font-family:"Courier New",serif'>     libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f0ef97b5000)<o:p></o:p></span></p><p class=MsoNormal><span style='font-family:"Courier New",serif'>     libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f0ef959f000)<o:p></o:p></span></p><p class=MsoNormal><span style='font-family:"Courier New",serif'>     libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f0ef91d5000)<o:p></o:p></span></p><p class=MsoNormal><span style='font-family:"Courier New",serif'>     libbz2.so.1.0 => /lib/x86_64-linux-gnu/libbz2.so.1.0 (0x00007f0ef8fc5000)<o:p></o:p></span></p><p class=MsoNormal><span style='font-family:"Courier New",serif'>     libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007f0ef8dab000)<o:p></o:p></span></p><p class=MsoNormal><span style='font-family:"Courier New",serif'>     libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f0ef8b8e000)<o:p></o:p></span></p><p class=MsoNormal><span style='font-family:"Courier New",serif'>     libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f0ef898a000)<o:p></o:p></span></p><p class=MsoNormal><span style='font-family:"Courier New",serif'>     /lib64/ld-linux-x86-64.so.2 (0x00007f0efa94b000)<o:p></o:p></span></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><span style='font-size:12.0pt'>Regards,<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:12.0pt'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:12.0pt'>Hemant<o:p></o:p></span></p></div></body></html>