mirror of
https://github.com/facebook/proxygen.git
synced 2026-10-24 01:33:54 +03:00
Fix CMake BUILD_SHARED_LIBS=ON support (#601)
Summary: Pull Request resolved: https://github.com/facebook/proxygen/pull/601 The granular CMake refactoring in D91009064 broke shared library builds. 1. `proxygen_add_library()` creates INTERFACE targets for shared builds, but `lib/CMakeLists.txt` called `target_include_directories(... PUBLIC ...)` on them. CMake only allows INTERFACE properties on INTERFACE targets. These calls were redundant since `proxygen_add_library()` already sets the same include directories. 2. In `proxygen_resolve_deferred_dependencies()`, `_obj` targets could fall through to linking against plain INTERFACE wrapper targets, which link to the monolithic `proxygen` shared library. Since `proxygen` is built from those same `_obj` targets, this creates a dependency cycle. Skip deps without an `_obj` version for `_obj` targets in shared builds. Reviewed By: jbeshay Differential Revision: D96253183 fbshipit-source-id: 1b0a1728c014b8475834e31ff09bbed7bd912948
This commit is contained in:
committed by
meta-codesync[bot]
parent
525c03fac0
commit
6c8097b1b8
@@ -434,6 +434,8 @@ function(proxygen_resolve_deferred_dependencies)
|
||||
# link to _obj for include path propagation
|
||||
if(BUILD_SHARED_LIBS AND _target MATCHES "_obj$" AND TARGET ${_dep}_obj)
|
||||
list(APPEND _valid_deps ${_dep}_obj)
|
||||
elseif(BUILD_SHARED_LIBS AND _target MATCHES "_obj$")
|
||||
# No _obj version exists; skip to avoid cycle through monolithic library
|
||||
elseif(TARGET ${_dep})
|
||||
list(APPEND _valid_deps ${_dep})
|
||||
endif()
|
||||
|
||||
@@ -114,12 +114,6 @@ proxygen_add_library(proxygen_http_http_common_headers
|
||||
proxygen-generated
|
||||
Folly::folly_range
|
||||
)
|
||||
target_include_directories(proxygen_http_http_common_headers PUBLIC
|
||||
$<BUILD_INTERFACE:${PROXYGEN_FBCODE_ROOT}>
|
||||
$<BUILD_INTERFACE:${PROXYGEN_GENERATED_ROOT}>
|
||||
$<INSTALL_INTERFACE:include/>
|
||||
)
|
||||
|
||||
proxygen_add_library(proxygen_utils_trace_event_types
|
||||
SRCS
|
||||
${PROXYGEN_GENERATED_ROOT}/proxygen/lib/utils/TraceEventType.cpp
|
||||
@@ -128,12 +122,6 @@ proxygen_add_library(proxygen_utils_trace_event_types
|
||||
proxygen-generated
|
||||
Folly::folly_conv
|
||||
)
|
||||
target_include_directories(proxygen_utils_trace_event_types PUBLIC
|
||||
$<BUILD_INTERFACE:${PROXYGEN_FBCODE_ROOT}>
|
||||
$<BUILD_INTERFACE:${PROXYGEN_GENERATED_ROOT}>
|
||||
$<INSTALL_INTERFACE:include/>
|
||||
)
|
||||
|
||||
# Granular library for http_parser
|
||||
proxygen_add_library(proxygen_external_http_parser
|
||||
SRCS
|
||||
|
||||
Reference in New Issue
Block a user