Skip to content

static libraries that need to be linked with whole-archive downstream #101

@jcar87

Description

@jcar87

is there a way for a CPS file that describes a static library, to model where a library should be linked as a "whole archive" downstream?

the end result is that the consumer passes something like the following to the linker:

-Wl,--whole-archive -foobar -Wl,--no-whole-archive

I think CMake has a related feature
https://discourse.cmake.org/t/automatically-wrapping-a-static-library-in-whole-archive-no-whole-archive-when-used-during-linking/5883/2

but I think it requires a proxy interface target to model this, e.g.

add_library(L INTERFACE)
target_link_libraries(L INTERFACE "$<LINK_LIBRARY:WHOLE_ARCHIVE,internal_L>")

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementThe issue asks for an improvement to the specification.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions