[PATCH] D72490: Fix cmake for zlib

Wenlei He via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 3 15:33:33 PST 2020


wenlei added a comment.

> I'm not sure I understand the motivation for this change. Can you please expand on that? How are you using it that it doesn't work for you?

@compnerd, the first problem is `system_libs` will be propagated into `INTERFACE_LINK_LIBRARIES` which is supposed to be relocatable (https://cmake.org/cmake/help/v3.3/prop_tgt/INTERFACE_LINK_LIBRARIES.html). However `ZLIB_LIBRARY` contains the absolute path zlib, so having `ZLIB_LIBRARY` in `system_libs` is wrong as it leads to non-relocatable interface libs.

> Additionally, z is definitely the wrong name, please compute that by using get_file_name_component, CMAKE_SHARED_LIBRARY_PREFIX, and string(REGEX...)

The problem also goes beyond absolute path vs relative path. If you look at line 11 for example, the way these libraries are described is like this: `rt` for `librt.so`. So we had to revert it back to use `z` for `zlib.so` for our usage of LLVM libs. What you suggested sounds like a good idea, but I won't be able to revisit this any time soon. So feel free to take over the patch. Thanks.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D72490/new/

https://reviews.llvm.org/D72490





More information about the llvm-commits mailing list