Add imported library to backend

Hi,

I am working on custom backend and I want to add custom pre-built
library (kind of external instruction encoder) to llvm build. I can
pass include path via CXXFLAGS and library path via LDFLAGS. But now I
am stuck with passing library itself (in form of -lmylib) to the
proper place at the end of linking line, just before system libraries.

Is there some official solution how to do it?

I tried to edit LIBS variable, but it seems to be not connected (I am
using cmake build system, not autotools). I also tried to write
directly add_library in main CMakeLists file of mine backend with
STATIC IMPORTED parameters. I can see some additions to
CMAKE_REQUIRED_LIBRARIES in config-ix.cmake but I do not want to edit
this file, because it is part of core llvm.