Skip to content

Conversation

@maxtropets
Copy link
Contributor

Kind of a follow up to #797

Even PRIVATE linkage retains

# Create imported target snmalloc::snmallocshim-static
add_library(snmalloc::snmallocshim-static STATIC IMPORTED)

set_target_properties(snmalloc::snmallocshim-static PROPERTIES
  INTERFACE_LINK_LIBRARIES "\$<LINK_ONLY:snmalloc::snmalloc>"
)

in the resulting cmake config.

https://cmake.org/cmake/help/latest/command/target_link_libraries.html#libraries-for-both-a-target-and-its-dependents says that

"Library dependencies are transitive by default with this signature. When this target is linked into another target then the libraries linked to this target will appear on the link line for the other target too. This transitive "link interface" is stored in the [INTERFACE_LINK_LIBRARIES](https://cmake.org/cmake/help/latest/prop_tgt/INTERFACE_LINK_LIBRARIES.html#prop_tgt:INTERFACE_LINK_LIBRARIES) target property and may be overridden by setting the property directly."

Therefore we unset the variable, although it doesn't look right, maybe.

Copy link
Member

@mjp41 mjp41 left a comment

Choose a reason for hiding this comment

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

LGTM, minor comment addition would be nice.

@mjp41 mjp41 merged commit 92ca918 into microsoft:main Oct 20, 2025
79 checks passed
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.

2 participants