Skip to content

Remove duplicate object inclusion for wslc executable#40331

Merged
benhillis merged 1 commit intofeature/wsl-for-appsfrom
copilot/fix-l2-cmake-doublelink
Apr 27, 2026
Merged

Remove duplicate object inclusion for wslc executable#40331
benhillis merged 1 commit intofeature/wsl-for-appsfrom
copilot/fix-l2-cmake-doublelink

Conversation

@benhillis
Copy link
Copy Markdown
Member

wslclib is an OBJECT library. Both the TARGET_OBJECTS generator expression in add_executable() and target_link_libraries(wslc wslclib) include the same object files. In CMake 3.12+, linking an OBJECT library brings both objects and transitive dependencies, making the generator expression redundant. Remove it to avoid potential duplicate symbol issues.

wslclib is an OBJECT library. Both \$<TARGET_OBJECTS:wslclib> in
add_executable() and target_link_libraries(wslc wslclib) include
the same object files. In CMake 3.12+, linking an OBJECT library
brings both objects and transitive dependencies, making the
generator expression redundant and potentially causing duplicate
symbol issues.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings April 25, 2026 22:11
@benhillis benhillis requested a review from a team as a code owner April 25, 2026 22:11
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR simplifies how wslc.exe is built by removing redundant inclusion of wslclib object files, relying on modern CMake behavior where linking an OBJECT library contributes its objects and usage requirements.

Changes:

  • Remove $<TARGET_OBJECTS:wslclib> from add_executable(wslc ...).
  • Add a clarifying comment explaining why the generator expression should not be used alongside linking the object library.

@benhillis benhillis merged commit 8a70358 into feature/wsl-for-apps Apr 27, 2026
12 checks passed
@benhillis benhillis deleted the copilot/fix-l2-cmake-doublelink branch April 27, 2026 21:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants