fix: let a program find the shared libraries it is built on
The link of an executable built on a LibraryDynamic dependency took lib<name>.so from the library's bin dir and recorded nowhere to find it at run time: no run path pointed there and nothing copied it beside the program, which mingw does for a DLL. The program failed at start with "cannot open shared object file". A shared library now hands its bin dir up as a run path, as a CMake external does with its build directory, and a program linked against it records it. Run paths reach the linker through -Xlinker, quoted for the shell (RunPathFlags), in a program's link and in project.so's: unlike the external cache's directories, the bin dir is the project's own, and clang splits a -Wl, value at every comma its name may hold.
This commit is contained in:
parent
aa6b555395
commit
bc98c87f01
4 changed files with 26 additions and 10 deletions
|
|
@ -54,8 +54,10 @@ export namespace Crafter {
|
|||
// when a consumer #includes them directly. Propagates transitively.
|
||||
std::set<std::string> publicCompileFlags;
|
||||
// Absolute directories the shared libraries this links against are
|
||||
// loaded from at run time, its dependencies' included. An executable
|
||||
// or shared library linked from them records each one as a run path.
|
||||
// loaded from at run time, its dependencies' included, and, once a
|
||||
// shared library is linked, its own bin dir, for its consumers. An
|
||||
// executable or shared library linked from them records each one as
|
||||
// a run path.
|
||||
std::set<std::string> runPaths;
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue