<div dir="ltr">Thanks! <div>This command really solve my problem.</div><div><br></div><div>But I still get a problem about the command order now.</div><div><br></div><div>I have some sub directories.</div><div>For e.g. One of them is called "src" and there is also a CMakeLists.txt in it. And the shared library installation instructions are in it.</div><div>So I have `ADD_SUBDIRECTORY(src)` in my main CMakeLists.txt. <br></div><div><br></div><div>I put the command `install(CODE "execute_process(COMMAND ldconfig)")`  after `ADD_SUBDIRECTORY(src)` . But It still  run ldconfig before the installation of shared libraries in src sub folder.</div><div><br></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Jun 16, 2016 at 9:02 PM, Matthew Keeler <span dir="ltr"><<a href="mailto:mkeeler@tenable.com" target="_blank">mkeeler@tenable.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div style="font-family:Helvetica,Arial;font-size:13px;color:rgba(0,0,0,1.0);margin:0px;line-height:auto">CMake won’t and in my opinion shouldn’t implicitly invoke ldconfig for you. There are many scenarios and platforms where this is incorrect behavior and some such as running install to prepare for packaging that CMake wouldn’t reliably be able to detect.</div><div style="font-family:Helvetica,Arial;font-size:13px;color:rgba(0,0,0,1.0);margin:0px;line-height:auto"><br></div><div style="font-family:Helvetica,Arial;font-size:13px;color:rgba(0,0,0,1.0);margin:0px;line-height:auto">If you want to provide the functionality for your users you could add something like the following to your CMakeLists.txt:</div><div style="font-family:Helvetica,Arial;font-size:13px;color:rgba(0,0,0,1.0);margin:0px;line-height:auto"><br></div><div style="font-family:Helvetica,Arial;font-size:13px;color:rgba(0,0,0,1.0);margin:0px;line-height:auto">install(CODE “execute_process(COMMAND ldconfig)”)</div> <div><br></div><div>This will need to run after your other installed targets. I can’t find any way in the CMake documentation to force install ordering but it seems like as long as CMake processes that install command last it will perform it last. So at the very end of your top level CMakeLists.txt file should do the trick. </div><br> <div><div style="font-family:helvetica,arial;font-size:13px">-- <br>Matt Keeler<br><br></div></div><div><div class="h5"> <br><p>On June 15, 2016 at 22:12:09, Young Yang (<a href="mailto:afe.young@gmail.com" target="_blank">afe.young@gmail.com</a>) wrote:</p> </div></div><blockquote type="cite"><span><div><div></div><div><div><div class="h5">





<div dir="ltr">
<div>Hi,</div>
<div>I've encountered some problem when writing install target with
cmake.</div>
<div><br></div>
<div>I use `install (TARGETS <my_shared_library> DESTINATION
lib)` to install my shared_library.</div>
<div>However, when I run `make install`. It just install the .so to
/usr/local/lib and didn't run the ldconfig.</div>
<div><br></div>
<div>I think it is strange and inconvenient to tell the user he
should run ldconfig by himself or herself.</div>
<div><br></div>
<div>What is the best way to make the ldconfig run
automatically?</div>
<div><br></div>
<div><br></div>
<div>Thanks in advance :)</div>
<div><br></div>
--<br>
<div data-smartmail="gmail_signature">
<div dir="ltr">
<div>
<div dir="ltr">
<div dir="ltr">
<div style="font-size:12.8px"><span style="font-size:small">Best
wishes,</span><br></div>
<div><font size="2">Young Yang</font></div>
</div>
</div>
</div>
</div>
</div>
</div></div></div>


--  
<br>
<br>Powered by <a href="http://www.kitware.com" 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" target="_blank">http://www.cmake.org/Wiki/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" target="_blank">http://cmake.org/cmake/help/support.html</a>
<br>CMake Consulting: <a href="http://cmake.org/cmake/help/consulting.html" target="_blank">http://cmake.org/cmake/help/consulting.html</a>
<br>CMake Training Courses: <a href="http://cmake.org/cmake/help/training.html" target="_blank">http://cmake.org/cmake/help/training.html</a>
<br>
<br>Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a>
<br>
<br>Follow this link to subscribe/unsubscribe:
<br><a href="http://public.kitware.com/mailman/listinfo/cmake" target="_blank">http://public.kitware.com/mailman/listinfo/cmake</a></div></div></span></blockquote></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div dir="ltr"><div style="font-size:12.8px"><span style="font-size:small">Best wishes,</span><br></div><div><font size="2">Young Yang</font></div></div></div></div></div></div>
</div>