[PATCH] D79219: [CMake] Simplify CMake handling for zlib

Xun Li via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 7 13:51:25 PDT 2020


lxfind added a comment.

In D79219#2201415 <https://reviews.llvm.org/D79219#2201415>, @phosek wrote:

> In D79219#2201109 <https://reviews.llvm.org/D79219#2201109>, @lxfind wrote:
>
>> @phosek, Under this change, now when I build LLVM (with a basic config `cmake -G Ninja --LLVM_ENABLE_PROJECTS=clang ../llvm`), in file `build_dir/lib/cmake/llvm/LLVMExports.cmake`, I see this:
>>
>>   set_target_properties(LLVMSupport PROPERTIES
>>     INTERFACE_LINK_LIBRARIES "curses;m;ZLIB::ZLIB;LLVMDemangle"
>>
>> This seems broken to me. Can you take a look?
>
> This is correct. That target is provided by `find_package(ZLIB)`. In LLVMConfig.cmake, we invoke `find_package(ZLIB)` when zlib support is enabled. If you're using `LLVMExports.cmake`, you'll need to invoke `find_package(ZLIB)` yourself.

@phosek, Thanks for the reply. I am not too familiar with this. Could you please elaborate more on why setting it to `ZLIB::ZLIB` here is more modern? And how one is expected to deal with `ZLIB::ZLIB` that shows up in LLVMExports.cmake` (in the modern way)? Should one string pattern matching for `ZLIB::ZLIB` and invoke `find_package(ZLIB)` again? (previously one could simply concatenate `-l` with the library name in there.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D79219



More information about the llvm-commits mailing list