CMake/Tests/InterfaceLinkLibrariesDirect/exe_use_static_A_public_explicit.c
Brad King 41a6b4a53b INTERFACE_LINK_LIBRARIES_DIRECT: Honor link dependencies through LINK_ONLY
In commit f3ad061858 (Add usage requirements to update direct link
dependencies, 2022-01-12, v3.23.0-rc1~44^2), we evaluated the transitive
closure of `INTERFACE_LINK_LIBRARIES` as a non-linking usage requirement.
That left out `INTERFACE_LINK_LIBRARIES_DIRECT` link dependencies that
appear behind private dependencies of a static library, guarded by the
`$<LINK_ONLY:...>` generator expression.  At the time, that decision was
intentional, in order to prevent arbitrary usage requirements from
leaking out of `PRIVATE` dependencies.

Since then, we've revised evaluation of `LINK_LIBRARIES` to distinguish
between collecting link dependencies and other usage requirements.  Use
that information when following `INTERFACE_LINK_LIBRARIES` to collect
the matching kind of requirements from `INTERFACE_LINK_LIBRARIES_DIRECT`.

Fixes: #22496
2022-03-22 11:57:48 -04:00

24 lines
595 B
C

#ifndef DEF_DIRECT_FROM_A
# error "DEF_DIRECT_FROM_A incorrectly not defined"
#endif
#ifndef DEF_DIRECT_FROM_A_FOR_EXE
# error "DEF_DIRECT_FROM_A_FOR_EXE incorrectly not defined"
#endif
#ifndef DEF_DIRECT_FROM_A_OPTIONAL
# error "DEF_DIRECT_FROM_A_OPTIONAL incorrectly not defined"
#endif
extern void static_A_public(void);
extern void not_direct_from_A(void);
extern void not_direct_from_A_for_exe(void);
extern void not_direct_from_A_optional(void);
int main(void)
{
static_A_public();
not_direct_from_A();
not_direct_from_A_for_exe();
not_direct_from_A_optional();
return 0;
}