cmComputeLinkInformation: Lookup a target only if we have one

The change in commit 27252b24 (cmComputeLinkInformation: Simplify
generator object access, 2015-08-02) broke the conditional use of a
target introduced in commit 41abdc17 (cmGeneratorTarget: Move GetSOName
from cmTarget, 2015-08-04).  Restore the conditional lookup.  Add a test
case that hacks platform information variables to trigger this code
everywhere.
This commit is contained in:
Brad King 2015-08-13 09:56:54 -04:00
parent 29886ce764
commit 9b449e9c5d
3 changed files with 12 additions and 1 deletions

View File

@ -760,7 +760,7 @@ void cmComputeLinkInformation::AddSharedDepItem(std::string const& item,
return;
}
cmGeneratorTarget *gtgt = this->GlobalGenerator->GetGeneratorTarget(tgt);
cmGeneratorTarget *gtgt = 0;
// Get a full path to the dependent shared library.
// Add it to the runtime path computation so that the target being

View File

@ -7,3 +7,4 @@ run_cmake(CMP0023-NEW-2)
run_cmake(MixedSignature)
run_cmake(Separate-PRIVATE-LINK_PRIVATE-uses)
run_cmake(SubDirTarget)
run_cmake(SharedDepNotTarget)

View File

@ -0,0 +1,10 @@
enable_language(C)
set(CMAKE_LINK_DEPENDENT_LIBRARY_DIRS 1)
set(CMAKE_SHARED_LIBRARY_SUFFIX ".so")
add_library(imported SHARED IMPORTED)
set_target_properties(imported PROPERTIES
IMPORTED_LOCATION "imported"
IMPORTED_LINK_DEPENDENT_LIBRARIES "/path/to/libSharedDep.so"
)
add_executable(empty empty.c)
target_link_libraries(empty imported)