<div dir="ltr"><div><div><div>Hi,<br></div><div><br>You can archive what youwant from the find_library() with NAMES parameter, for example, find_library(THELIB NAMES libthelib.a thelib-static thelib), it would try to pick the static library firstly.<br></div><br></div>Boost. You have to set <span class="gmail-m_-6812827782751170800gmail-n">Boost_USE_STATIC_LIBS before find_package(Boost), so the CMake would try to pick up the static libraries, of course, you should already own the static libraries.<br></span></div><div><span class="gmail-m_-6812827782751170800gmail-n"><br></span></div><div><span class="gmail-m_-6812827782751170800gmail-n">Thank you very much and good luck.<br></span></div><br><span class="gmail-m_-6812827782751170800gmail-n"></span><div><span class="gmail-m_-6812827782751170800gmail-n"><br></span></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Jun 7, 2018 at 8:07 AM, <span dir="ltr"><<a href="mailto:hemant@mnkcg.com" target="_blank">hemant@mnkcg.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div link="#0563C1" vlink="#954F72" lang="EN-US"><div class="m_9091494547113343435WordSection1"><p class="MsoNormal"><span style="font-size:12.0pt">Hi folks,<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:12.0pt"><u></u> <u></u></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.<u></u><u></u></span></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal"><span style="font-family:"Courier New",serif">$ <span style="background:yellow">ldd p4c-xp</span><u></u><u></u></span></p><p class="MsoNormal"><span style="font-family:"Courier New",serif"> linux-vdso.so.1 => (0x00007ffd2cd06000)<u></u><u></u></span></p><p class="MsoNormal"><span style="font-family:"Courier New",serif"> libboost_iostreams.so.1.58.0 => /usr/lib/x86_64-linux-gnu/<wbr>libboost_iostreams.so.1.58.0 (0x00007f0efa732000)<u></u><u></u></span></p><p class="MsoNormal"><span style="font-family:"Courier New",serif"> libgmp.so.10 => /usr/local/lib/libgmp.so.10 (0x00007f0efa4bb000)<u></u><u></u></span></p><p class="MsoNormal"><span style="font-family:"Courier New",serif"> libgmpxx.so.4 => /usr/lib/x86_64-linux-gnu/<wbr>libgmpxx.so.4 (0x00007f0efa2b5000)<u></u><u></u></span></p><p class="MsoNormal"><span style="font-family:"Courier New",serif"> libgc.so.1 => /usr/local/lib/libgc.so.1 (0x00007f0efa048000)<u></u><u></u></span></p><p class="MsoNormal"><span style="font-family:"Courier New",serif"> librt.so.1 => /lib/x86_64-linux-gnu/librt.<wbr>so.1 (0x00007f0ef9e40000)<u></u><u></u></span></p><p class="MsoNormal"><span style="font-family:"Courier New",serif"> libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/<wbr>libstdc++.so.6 (0x00007f0ef9abe000)<u></u><u></u></span></p><p class="MsoNormal"><span style="font-family:"Courier New",serif"> libm.so.6 => /lib/x86_64-linux-gnu/libm.so.<wbr>6 (0x00007f0ef97b5000)<u></u><u></u></span></p><p class="MsoNormal"><span style="font-family:"Courier New",serif"> libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_<wbr>s.so.1 (0x00007f0ef959f000)<u></u><u></u></span></p><p class="MsoNormal"><span style="font-family:"Courier New",serif"> libc.so.6 => /lib/x86_64-linux-gnu/libc.so.<wbr>6 (0x00007f0ef91d5000)<u></u><u></u></span></p><p class="MsoNormal"><span style="font-family:"Courier New",serif"> libbz2.so.1.0 => /lib/x86_64-linux-gnu/libbz2.<wbr>so.1.0 (0x00007f0ef8fc5000)<u></u><u></u></span></p><p class="MsoNormal"><span style="font-family:"Courier New",serif"> libz.so.1 => /lib/x86_64-linux-gnu/libz.so.<wbr>1 (0x00007f0ef8dab000)<u></u><u></u></span></p><p class="MsoNormal"><span style="font-family:"Courier New",serif"> libpthread.so.0 => /lib/x86_64-linux-gnu/<wbr>libpthread.so.0 (0x00007f0ef8b8e000)<u></u><u></u></span></p><p class="MsoNormal"><span style="font-family:"Courier New",serif"> libdl.so.2 => /lib/x86_64-linux-gnu/libdl.<wbr>so.2 (0x00007f0ef898a000)<u></u><u></u></span></p><p class="MsoNormal"><span style="font-family:"Courier New",serif"> /lib64/ld-linux-x86-64.so.2 (0x00007f0efa94b000)<u></u><u></u></span></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal"><span style="font-size:12.0pt">Regards,<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:12.0pt"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:12.0pt">Hemant<u></u><u></u></span></p></div></div><br>-- <br>
<br>
Powered by <a href="http://www.kitware.com" rel="noreferrer" target="_blank">www.kitware.com</a><br>
<br>
Please keep messages on-topic and check the CMake FAQ at: <a href="http://www.cmake.org/Wiki/CMake_FAQ" rel="noreferrer" target="_blank">http://www.cmake.org/Wiki/<wbr>CMake_FAQ</a><br>
<br>
Kitware offers various services to support the CMake community. For more information on each offering, please visit:<br>
<br>
CMake Support: <a href="http://cmake.org/cmake/help/support.html" rel="noreferrer" target="_blank">http://cmake.org/cmake/help/<wbr>support.html</a><br>
CMake Consulting: <a href="http://cmake.org/cmake/help/consulting.html" rel="noreferrer" target="_blank">http://cmake.org/cmake/help/<wbr>consulting.html</a><br>
CMake Training Courses: <a href="http://cmake.org/cmake/help/training.html" rel="noreferrer" target="_blank">http://cmake.org/cmake/help/<wbr>training.html</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer" target="_blank">http://www.kitware.com/<wbr>opensource/opensource.html</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="https://cmake.org/mailman/listinfo/cmake" rel="noreferrer" target="_blank">https://cmake.org/mailman/<wbr>listinfo/cmake</a><br>
<br></blockquote></div><br></div>