Skip to content

Fix CMake BUILD_SHARED_LIBS=ON support#601

Closed
afrind wants to merge 1 commit intofacebook:mainfrom
afrind:export-D96253183
Closed

Fix CMake BUILD_SHARED_LIBS=ON support#601
afrind wants to merge 1 commit intofacebook:mainfrom
afrind:export-D96253183

Conversation

@afrind
Copy link
Contributor

@afrind afrind commented Mar 12, 2026

Summary:
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.

Differential Revision: D96253183

Summary:
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.

Differential Revision: D96253183
@meta-cla meta-cla bot added the CLA Signed label Mar 12, 2026
@meta-codesync
Copy link

meta-codesync bot commented Mar 12, 2026

@afrind has exported this pull request. If you are a Meta employee, you can view the originating Diff in D96253183.

@meta-codesync
Copy link

meta-codesync bot commented Mar 12, 2026

This pull request has been merged in 6c8097b.

meta-codesync bot pushed a commit to facebook/hhvm that referenced this pull request Mar 12, 2026
Summary:
X-link: facebook/proxygen#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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant