Commit 869328aa authored by Stephen Kelly's avatar Stephen Kelly
Browse files

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
parent aa0a3562
......@@ -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.
for(std::vector<std::string>::const_iterator lib = tlibs.begin();
lib != tlibs.end(); ++lib)
// Don't emit the same library twice for this target.
this->AddTargetDepend(depender_index, *lib, true);
this->AddInterfaceDepends(depender_index, *lib,
true, emitted);
std::vector<std::string> configs;
if (configs.empty())
for (std::vector<std::string>::const_iterator it = configs.begin();
it != configs.end(); ++it)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment