[CMake] Fix OCaml build failure because of absolute path in system libs
authorPetr Hosek <phosek@google.com>
Wed, 19 Aug 2020 17:33:03 +0000 (10:33 -0700)
committerPetr Hosek <phosek@google.com>
Wed, 19 Aug 2020 17:33:03 +0000 (10:33 -0700)
commit8e4acb82f71ad4effec8895b8fc957189ce95933
tree2fcae10d74bc345b7b1a4d20728a95d39bd667ad
parent495f91fd33d492941c39424a32cf24bcfe192f35
[CMake] Fix OCaml build failure because of absolute path in system libs

D85820 introduced a full path in the LLVM_SYSTEM_LIBS property of the
LLVMSupport target, which made the OCaml bindings fail to build, since
they use -l [system_lib] flags for every lib in LLVM_SYSTEM_LIBS, which
cannot work with absolute paths.

This patch solves the issue in a similar vain as ZLIB does it: it adds
the full library path to imported_libs, and adds a stripped down version
without directories, lib prefix and lib suffix to system_libs

In the future we should probably make some changes to LLVM_SYSTEM_LIBS,
since both zlib and ncurses do not necessarily have to be system libs
anymore due to the find_package / find_library bits introduced in
D85820 and D79219.

Patch By: haampie

Differential Revision: https://reviews.llvm.org/D86134
llvm/lib/Support/CMakeLists.txt