mirror of
https://github.com/facebook/proxygen.git
synced 2026-10-28 14:37:23 +03:00
Summary: `FindGlog` creates the `glog::glog` imported target whether or not it found anything. When glog is missing the target is there all the same, pointing at `GLOG_LIBRARY-NOTFOUND`, so nothing goes wrong until the link step reports `ld: library 'GLOG_LIBRARY-NOTFOUND' not found`. The same block also runs `find_package(Gflags)` and `find_package(LibUnwind)` to fill in glog's own dependencies, two searches that have nothing to contribute when there is no glog to attach them to. Guarding the block on `GLOG_FOUND`, the way `FindGflags` already guards its `gflags` target, makes a failed search report itself at configure time and leaves the namespace clear. That second part matters to folly. A fetched glog declares `glog::glog` as an `ALIAS`, and CMake rejects an alias whose name is already taken, so the previous diff had to run the module's library search by hand and pick between find and fetch before `FindGlog` could get to it. That workaround goes away and the block reads as `find_package` plus a fallback again, like every other dependency in the file. Reaching the module in the not-found case does leave two of its variables to account for on folly's side. `GLOG_LIBRARIES` is named in the `EXPORTED_DEPS` of 42 of folly's granular libraries, so the fetch branch points it at `glog::glog`. `GLOG_INCLUDE_DIR` only means anything when glog was found, so appending it and the `glog/export.h` check that goes with it move into that branch. Reviewed By: bigfootjon Differential Revision: D120177659 fbshipit-source-id: ee65caed9aa25b4517b8b952b826b451b462f96b