This is an archive of the discontinued LLVM Phabricator instance.

[cmake] Fix zlib library detection
ClosedPublic

Authored by labath on Dec 4 2017, 3:33 AM.

Details

Summary

A couple of people were broken by the previous zlib patch. It turned out
this was because I used find_libraries for searching for the z library.
This returns absolute paths, and when these paths made it into
llvm-config, it made it produce nonsensical flags for the --system-libs
output. To fix this, I hand-roll a search for the library in the same
way that we search for the terminfo library a couple of lines below.

This is a bit less flexible than the find_library option, as it does not
allow the user to specify the path to the library at configure time
(which is important on windows, as zlib is unlikely to be found in any
of the standard places cmake searches), but I was able to guide the
build to find it with appropriate values of LIB and INCLUDE environment
variables.

Event Timeline

labath created this revision.Dec 4 2017, 3:33 AM
compnerd accepted this revision.Dec 4 2017, 3:21 PM
compnerd added a subscriber: compnerd.
compnerd added inline comments.
cmake/config-ix.cmake
143

It might be nicer if this was out-of-lined.

This revision is now accepted and ready to land.Dec 4 2017, 3:21 PM
This revision was automatically updated to reflect the committed changes.
labath added inline comments.Dec 5 2017, 2:28 AM
cmake/config-ix.cmake
143

I think that makes sense only if that code is made more generic so it can be re-used. I could make a patch that makes a more generic version of this, and then use that to implement the search for zlib and terminfo. What do you think?