forked from facebook/fbthrift
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[thrift] Add FindProxygen cmake module
Proxygen uses autoconf at the moment (soon to switch to cmake)
- Loading branch information
Showing
1 changed file
with
85 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
# This will go away as soon as Proxygen switches over to cmake. | ||
# | ||
# Hints: | ||
# Set PROXYGEN_ROOT_DIR to the installation prefix of proxygen | ||
# | ||
# Results: | ||
# Sets proxygen_FOUND and defines the proxygen::proxygen TARGET | ||
|
||
include(FindPackageHandleStandardArgs) | ||
set(CMAKE_FIND_LIBRARY_SUFFIXES .a) | ||
|
||
find_path( | ||
PROXYGEN_INCLUDE_DIR | ||
NAMES | ||
proxygen/lib/http/HTTPMessage.h | ||
HINTS | ||
${PROXYGEN_ROOT_DIR} | ||
) | ||
|
||
find_library( | ||
PROXYGEN_LIBRARY | ||
NAMES | ||
proxygenlib | ||
HINTS | ||
${PROXYGEN_ROOT_DIR} | ||
) | ||
|
||
find_library( | ||
PROXYGEN_LIBRARY_HTTPSERVER | ||
NAMES | ||
proxygenhttpserver | ||
HINTS | ||
${PROXYGEN_ROOT_DIR} | ||
) | ||
|
||
find_package_handle_standard_args(proxygen | ||
REQUIRED_VARS | ||
PROXYGEN_INCLUDE_DIR | ||
PROXYGEN_LIBRARY | ||
PROXYGEN_LIBRARY_HTTPSERVER | ||
FAIL_MESSAGE | ||
"Could not find proxygen. Try setting the proxygen installation prefix with PROXYGEN_ROOT_DIR" | ||
) | ||
if(proxygen_FOUND) | ||
if(NOT TARGET proxygen::lib) | ||
add_library(proxygen::lib STATIC IMPORTED) | ||
set_target_properties(proxygen::lib PROPERTIES | ||
IMPORTED_LINK_INTERFACE_LANGUAGES "CXX" | ||
IMPORTED_LOCATION "${PROXYGEN_LIBRARY}" | ||
) | ||
set_property( | ||
TARGET proxygen::lib | ||
APPEND | ||
PROPERTY INTERFACE_LINK_LIBRARIES | ||
Folly::folly | ||
wangle::wangle | ||
fizz::fizz | ||
) | ||
endif() | ||
|
||
if (NOT TARGET proxygen::httpserver) | ||
add_library(proxygen::httpserver STATIC IMPORTED) | ||
set_target_properties(proxygen::httpserver PROPERTIES | ||
IMPORTED_LINK_INTERFACE_LANGUAGES "CXX" | ||
IMPORTED_LOCATION "${PROXYGEN_LIBRARY_HTTPSERVER}" | ||
INTERFACE_LINK_LIBRARIES proxygen::lib | ||
) | ||
endif() | ||
|
||
if (NOT TARGET proxygen::proxygen) | ||
add_library(proxygen::proxygen INTERFACE IMPORTED) | ||
set_property(TARGET proxygen::proxygen APPEND PROPERTY INTERFACE_LINK_LIBRARIES proxygen::httpserver proxygen::lib) | ||
get_target_property(things proxygen::proxygen INTERFACE_LINK_LIBRARIES) | ||
message(wut "${things}") | ||
set_target_properties( | ||
proxygen::proxygen | ||
PROPERTIES | ||
INTERFACE_INCLUDE_DIRECTORIES | ||
${PROXYGEN_INCLUDE_DIR} | ||
) | ||
endif() | ||
|
||
message("Found proxygen") | ||
endif() | ||
|