ldc-developers / ldc

The LLVM-based D Compiler.
http://wiki.dlang.org/LDC
Other
1.18k stars 255 forks source link

Support CMAKE_INSTALL_LIBDIR ? #4695

Open CyberShadow opened 4 days ago

CyberShadow commented 4 days ago

Hi,

It would be nice to be able to specify cmake -DCMAKE_INSTALL_LIBDIR=/some/path/..., so that the libraries are installed into a directory that's separate from the compiler binaries.

I don't think that's possible to do right now - I see a lot of explicit mentions of ${CMAKE_INSTALL_PREFIX}/lib.

I'm hoping that this will make it easier to package LDC so that the shared libraries can be a separate package, which don't depend on the compiler (which itself depends on LLVM which is quite heavy), e.g. https://github.com/NixOS/nixpkgs/issues/324306.

kinke commented 3 days ago

There is a CMAKE_INSTALL_LIBDIR variable in https://github.com/ldc-developers/ldc/blob/master/runtime/CMakeLists.txt#L50 (overriding a user-specified one ATM), but it's only used for the rpath and the ldc2.conf file, not as install destination dir. The multilib stuff complicates matters (MULTILIB_SUFFIX).

Another potential route is to build the shared libs separately using the ldc-build-runtime tool, and specifying a suited CMAKE_INSTALL_PREFIX for that build.