install(RUNTIME_DEPENDENCIES): Searches in DIRECTORIES although the dependency is found in rpath
When installing RUNTIME_DEPENDENCIES
, the dependencies are search inside the usual paths first.
If they are not found there, they are searched inide ehe paths stated in DIRECTORIES
.
This behavior is mentioned in the documentation and I think it is reasonable.
When using RUNTIME_DEPENDENCIES
on Linux, the dependencies are search inside all rpath
directories.
For some reasons, cmake also searches for them inside the DIRECOTRIES
even if they are found inside on of the rpath
directories.
When analyzing the output of cmake, it looks like cmake first searches inside the DIRECOTRIES
paths and after that, the rpath
directories are searched:
CMake Warning at src/batch/cmake_install.cmake:76 (file):
Dependency libQt5Core.so.5 found in search directory:
<external-dir-stated-in-DIRECOTRIES>
See file(GET_RUNTIME_DEPENDENCIES) documentation for more information.
Call Stack (most recent call first):
cmake_install.cmake:52 (include)
CMake Error at src/batch/cmake_install.cmake:76 (file):
file Multiple conflicting paths found for libQt5Core.so.5:
<external-dir-stated-in-DIRECOTRIES>/libQt5Core.so.5
/Qt5.15.2/5.15.2/gcc_64/lib/libQt5Core.so.5
Call Stack (most recent call first):
cmake_install.cmake:52 (include)
Note that /Qt5.15.2/5.15.2/gcc_64/lib
is part of the BUILD_RPATH
Edited by NelDav