CMake/Tests/ExportImport/Export/testLibDepends.c
Brad King aea1b03617 Fix export of STATIC library PRIVATE dependencies with CMP0022 NEW
The target_link_libraries command records the PRIVATE dependencies of a
STATIC library in INTERFACE_LINK_LIBRARIES as "$<LINK_ONLY:dep>".  This
hides the target name from export namespacing logic inside a generator
expression.  When user-written generator expressions reference a target
name they must put it inside a "$<TARGET_NAME:dep>" expression to allow
the export logic to rename the target.  In the case that the private
dependency is not already a generator expression, target_link_libraries
must use "$<LINK_ONLY:$<TARGET_NAME:dep>>" to allow the export logic to
rename the target.

Reported-by: Tamás Kenéz <tamas.kenez@gmail.com>
2016-01-15 10:18:53 -05:00

26 lines
521 B
C

#include "testLibIncludeRequired1.h"
#include "testLibIncludeRequired2.h"
#include "testLibIncludeRequired4.h"
#ifndef testLibRequired_IFACE_DEFINE
#error Expected testLibRequired_IFACE_DEFINE
#endif
#ifndef BuildOnly_DEFINE
#error Expected BuildOnly_DEFINE
#endif
#ifdef InstallOnly_DEFINE
#error Unexpected InstallOnly_DEFINE
#endif
extern int testLibRequired(void);
extern int testStaticLibRequiredPrivate(void);
int testLibDepends(void) {
return testLibRequired()
+ testStaticLibRequiredPrivate()
;
}