Commit 430228fc authored by Wez Furlong's avatar Wez Furlong Committed by Facebook Github Bot

folly: cmake: fixup libevent include dirs

Summary:
When finding a package via its config, we need to
add its include dirs to our list.  Previously we were squeaking
by for this because libevent was installed in either the default
include path or in the same installation prefix as folly.

In the getdeps build environment we have libevent in its own
installation prefix.

The `LibeventConfig.cmake` file from libevent `release-2.1.8-stable` exports
the include dirs via the `LIBEVENT_INCLUDE_DIRS` variable, which is slightly
different from that used by the `folly/public_tld/CMake/FindLibEvent.cmake`
file.

In a later diff I plan to standardize and move the libevent
logic to the common cmake dir.  For now, this unblocks my build.

Reviewed By: strager

Differential Revision: D14680677

fbshipit-source-id: 9f757c84fd145d052925803348008dc2c1abf263
parent df5f9801
...@@ -35,8 +35,18 @@ list(APPEND FOLLY_INCLUDE_DIRECTORIES ${GLOG_INCLUDE_DIR}) ...@@ -35,8 +35,18 @@ list(APPEND FOLLY_INCLUDE_DIRECTORIES ${GLOG_INCLUDE_DIR})
find_package(Libevent CONFIG QUIET) find_package(Libevent CONFIG QUIET)
if(TARGET event) if(TARGET event)
message(STATUS "Found libevent from package config") message(STATUS "Found libevent from package config inc=${LIBEVENT_INCLUDE_DIRS}")
list(APPEND FOLLY_SHINY_DEPENDENCIES event) list(APPEND FOLLY_SHINY_DEPENDENCIES event)
# Somewhat gross, but some vcpkg installed libevents have a relative
# `include` path exported into LIBEVENT_INCLUDE_DIRS, which triggers
# a cmake error because it resolves to the `include` dir within the
# folly repo, which is not something cmake allows to be in the
# INTERFACE_INCLUDE_DIRECTORIES. Thankfully on such a system the
# actual include directory is already part of the global include
# directories, so we can just skip it.
if (NOT "${LIBEVENT_INCLUDE_DIRS}" STREQUAL "include")
list(APPEND FOLLY_INCLUDE_DIRECTORIES ${LIBEVENT_INCLUDE_DIRS})
endif()
else() else()
find_package(LibEvent MODULE REQUIRED) find_package(LibEvent MODULE REQUIRED)
list(APPEND FOLLY_LINK_LIBRARIES ${LIBEVENT_LIB}) list(APPEND FOLLY_LINK_LIBRARIES ${LIBEVENT_LIB})
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment