cmComputeTargetDepends: Use valid config to compute target depends.

If CMAKE_BUILD_TYPE is set, and user code contains:

 target_link_libraries(myexe prefix_$<$<CONFIG:Debug>:debug>)

then the computation with an empty config was computing a target-level
dependency on a target or library called prefix_, and a dependency
on a target or library called prefix_debug (as expected).

The existing logic skips 'prefix_' because it is not a known target,
and defers to the link-dependencies logic to find the library. The
link-dependencies logic does not incorrectly handle the config as
cmComputeTargetDepends did, and so did not encounter 'prefix_'
during its computation. This likely had no effect on the generated
buildsystem.
This commit is contained in:
Stephen Kelly 2014-03-25 13:34:38 +01:00
parent aa0a3562dd
commit 869328aac3

View File

@ -241,25 +241,12 @@ void cmComputeTargetDepends::CollectTargetDepends(int depender_index)
}
}
}
{
std::vector<std::string> tlibs;
depender->GetDirectLinkLibraries("", tlibs, depender);
// A target should not depend on itself.
emitted.insert(depender->GetName());
for(std::vector<std::string>::const_iterator lib = tlibs.begin();
lib != tlibs.end(); ++lib)
{
// Don't emit the same library twice for this target.
if(emitted.insert(*lib).second)
{
this->AddTargetDepend(depender_index, *lib, true);
this->AddInterfaceDepends(depender_index, *lib,
true, emitted);
}
}
}
std::vector<std::string> configs;
depender->GetMakefile()->GetConfigurations(configs);
if (configs.empty())
{
configs.push_back("");
}
for (std::vector<std::string>::const_iterator it = configs.begin();
it != configs.end(); ++it)
{