[CMake] cmake install target doesn't run ldconfig after installing library

Matthew Keeler mkeeler at tenable.com
Thu Jun 16 09:02:17 EDT 2016


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.

If you want to provide the functionality for your users you could add
something like the following to your CMakeLists.txt:

install(CODE “execute_process(COMMAND ldconfig)”)

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.

-- 
Matt Keeler


On June 15, 2016 at 22:12:09, Young Yang (afe.young at gmail.com) wrote:

Hi,
I've encountered some problem when writing install target with cmake.

I use `install (TARGETS <my_shared_library> DESTINATION lib)` to install my
shared_library.
However, when I run `make install`. It just install the .so to
/usr/local/lib and didn't run the ldconfig.

I think it is strange and inconvenient to tell the user he should run
ldconfig by himself or herself.

What is the best way to make the ldconfig run automatically?


Thanks in advance :)

--
Best wishes,
Young Yang
-- 

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://public.kitware.com/mailman/listinfo/cmake
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20160616/bffab6df/attachment.html>


More information about the CMake mailing list