Merge topic 'transitive-shared-lib-depend'

183b950 Follow all dependencies of shared library private dependencies
This commit is contained in:
David Cole 2011-12-16 10:15:01 -05:00 committed by CMake Topic Stage
commit 2f82798ef8
4 changed files with 27 additions and 3 deletions

View File

@ -429,7 +429,8 @@ void cmComputeLinkDepends::HandleSharedDependency(SharedDepEntry const& dep)
if(cmTarget::LinkInterface const* iface =
entry.Target->GetLinkInterface(this->Config))
{
// We use just the shared dependencies, not the interface.
// Follow public and private dependencies transitively.
this->QueueSharedDependencies(index, iface->Libraries);
this->QueueSharedDependencies(index, iface->SharedDeps);
}
}

View File

@ -23,8 +23,13 @@ add_library(testLib1 STATIC testLib1.c)
add_library(testLib2 STATIC testLib2.c)
target_link_libraries(testLib2 testLib1)
# Test library with empty link interface. Link it to an implementation
# dependency that itself links to dependencies publicly.
add_library(testLib3ImpDep SHARED testLib3ImpDep.c)
set_property(TARGET testLib3ImpDep PROPERTY LIBRARY_OUTPUT_DIRECTORY impl/dep)
add_library(testLib3Imp SHARED testLib3Imp.c)
set_property(TARGET testLib3Imp PROPERTY LIBRARY_OUTPUT_DIRECTORY impl)
target_link_libraries(testLib3Imp testLib3ImpDep)
add_library(testLib3 SHARED testLib3.c)
target_link_libraries(testLib3 testLib3Imp)
set_property(TARGET testLib3 PROPERTY LINK_INTERFACE_LIBRARIES "")
@ -104,6 +109,14 @@ install(
LIBRARY DESTINATION lib/impl
ARCHIVE DESTINATION lib/impl
)
install(
TARGETS
testLib3ImpDep
EXPORT exp
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib/impl/dep
ARCHIVE DESTINATION lib/impl/dep
)
install(
TARGETS testLib5
EXPORT exp
@ -120,7 +133,7 @@ endif(WIN32)
# Export from build tree.
export(TARGETS testExe1 testLib1 testLib2 testLib3
testExe2libImp testLib3Imp
testExe2libImp testLib3Imp testLib3ImpDep
NAMESPACE bld_
FILE ExportBuildTree.cmake
)

View File

@ -1,7 +1,10 @@
#if defined(_WIN32) || defined(__CYGWIN__)
# define testLib3Imp_EXPORT __declspec(dllexport)
# define testLib3ImpDep_IMPORT __declspec(dllimport)
#else
# define testLib3Imp_EXPORT
# define testLib3ImpDep_IMPORT
#endif
testLib3Imp_EXPORT int testLib3Imp(void) { return 0; }
testLib3ImpDep_IMPORT int testLib3ImpDep(void);
testLib3Imp_EXPORT int testLib3Imp(void) { return testLib3ImpDep(); }

View File

@ -0,0 +1,7 @@
#if defined(_WIN32) || defined(__CYGWIN__)
# define testLib3ImpDep_EXPORT __declspec(dllexport)
#else
# define testLib3ImpDep_EXPORT
#endif
testLib3ImpDep_EXPORT int testLib3ImpDep(void) { return 0; }