• Wez Furlong's avatar
    folly:wangle: fixup libevent detection and export · 9a29672d
    Wez Furlong authored
    Summary:
    I finally got to the bottom of the weird `-levent` or `event.lib`
    linker errors that crop up in the cmake builds.
    
    The issue is that if you have installed a recent libevent it deploys
    a cmake CONFIG package that exports just a bare `event` target as the
    dep on libevent.  This is unfortunate because it is interpreted as
    meaning `-levent` with no library path, which for an installation
    of libevent that is not in the default path will result in linker
    errors in libraries downstream of folly.
    
    To resolve this, I've given the common `FindLibEvent.cmake` file
    (that was derived from the folly library of the same name) a similar
    treatment to the recent changes to find glog and taught it how to
    locate libevent from a config package and to fall back on a basic
    include/library check.
    
    If we find an `event` target then we extract the actual library
    path from it and export that.
    
    I've removed folly's and wangle's own FindLibEvent.cmake so that it will pick
    up the common library which gets shipit sync'd out to
    https://github.com/facebook/folly/blob/master/CMake/FindLibEvent.cmake
    and https://github.com/facebook/wangle/blob/master/build/fbcode_builder/CMake/FindLibEvent.cmake
    
    Reviewed By: yfeldblum
    
    Differential Revision: D14702577
    
    fbshipit-source-id: d35d9f741e009dcd77976c0637ba3024a8a4aef3
    9a29672d
folly-deps.cmake 6.18 KB