"make install" is wrong to install library dependencies under Linux
make install
(or ninja install
) is broken, at least under Linux.
It currently takes library dependencies that are properly installed on the host system, and copies them to a second install location derived from the CMake install prefix.
This triggers a CMake warning if cmake
is run after make install
[1]. The warning is fully explained here [2].
Root cause
We are confounding regular installation with creation of a binary package. Copying installed libraries is (sadly) necessary in the second case, but must not be done in the first case.
References
[1] To reproduce: Install. Then rerun cmake
in build directory. Output has plenty of these:
CMake Warning at Tests/Unit/GUI/CMakeLists.txt:13 (add_executable):
Cannot generate a safe runtime search path for target UnitTestGUI because
files in some directories may conflict with libraries in implicit
directories:
runtime library [libtiff.so.6] in /usr/lib/x86_64-linux-gnu may be hidden by files in:
/usr/local/lib
runtime library [libtiffxx.so.6] in /usr/lib/x86_64-linux-gnu may be hidden by files in:
/usr/local/lib
runtime library [libgsl.so.27] in /usr/lib/x86_64-linux-gnu may be hidden by files in:
/usr/local/lib
runtime library [libgslcblas.so.0] in /usr/lib/x86_64-linux-gnu may be hidden by files in:
/usr/local/lib
runtime library [libfftw3.so.3] in /usr/lib/x86_64-linux-gnu may be hidden by files in:
/usr/local/lib
runtime library [libboost_iostreams.so.1.83.0] in /usr/lib/x86_64-linux-gnu may be hidden by files in:
/usr/local/lib
runtime library [libboost_program_options.so.1.83.0] in /usr/lib/x86_64-linux-gnu may be hidden by files in:
/usr/local/lib
runtime library [libQt6OpenGLWidgets.so.6] in /usr/lib/x86_64-linux-gnu may be hidden by files in:
/usr/local/lib
runtime library [libQt6OpenGL.so.6] in /usr/lib/x86_64-linux-gnu may be hidden by files in:
/usr/local/lib
runtime library [libQt6PrintSupport.so.6] in /usr/lib/x86_64-linux-gnu may be hidden by files in:
/usr/local/lib
runtime library [libQt6Widgets.so.6] in /usr/lib/x86_64-linux-gnu may be hidden by files in:
/usr/local/lib
runtime library [libQt6Gui.so.6] in /usr/lib/x86_64-linux-gnu may be hidden by files in:
/usr/local/lib
runtime library [libQt6Core.so.6] in /usr/lib/x86_64-linux-gnu may be hidden by files in:
/usr/local/lib
Some of these libraries may not be found correctly.
Edited by Wuttke, Joachim