diff options
author | Brad King <brad.king@kitware.com> | 2015-07-28 18:05:34 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2015-07-28 19:40:06 (GMT) |
commit | 6d79eda769a5693ed4657f50c97ef5a0c9ba2e1b (patch) | |
tree | c91d0978ecf2d24621fb53d1a7911f63a0058ded /Source/cmCommonTargetGenerator.cxx | |
parent | 98d6e9ec2dd0a935b1ebfed50b6e9ecab719557d (diff) | |
download | CMake-6d79eda769a5693ed4657f50c97ef5a0c9ba2e1b.zip CMake-6d79eda769a5693ed4657f50c97ef5a0c9ba2e1b.tar.gz CMake-6d79eda769a5693ed4657f50c97ef5a0c9ba2e1b.tar.bz2 |
cmCommonTargetGenerator: Adopt linked target directory computation
Factor a GetLinkedTargetDirectories method out of
cmMakefileTargetGenerator::WriteTargetDependRules to compute the list of
directories associated with targets to which the current target links.
Diffstat (limited to 'Source/cmCommonTargetGenerator.cxx')
-rw-r--r-- | Source/cmCommonTargetGenerator.cxx | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/Source/cmCommonTargetGenerator.cxx b/Source/cmCommonTargetGenerator.cxx index 2225fdc..c75ac23 100644 --- a/Source/cmCommonTargetGenerator.cxx +++ b/Source/cmCommonTargetGenerator.cxx @@ -368,3 +368,37 @@ std::string cmCommonTargetGenerator::GetIncludes(std::string const& l) } return i->second; } + +std::vector<std::string> +cmCommonTargetGenerator::GetLinkedTargetDirectories() const +{ + std::vector<std::string> dirs; + std::set<cmTarget const*> emitted; + if (cmComputeLinkInformation* cli = + this->Target->GetLinkInformation(this->ConfigName)) + { + cmComputeLinkInformation::ItemVector const& items = cli->GetItems(); + for(cmComputeLinkInformation::ItemVector::const_iterator + i = items.begin(); i != items.end(); ++i) + { + cmTarget const* linkee = i->Target; + if(linkee && !linkee->IsImported() + // We can ignore the INTERFACE_LIBRARY items because + // Target->GetLinkInformation already processed their + // link interface and they don't have any output themselves. + && linkee->GetType() != cmTarget::INTERFACE_LIBRARY + && emitted.insert(linkee).second) + { + cmGeneratorTarget* gt = + this->GlobalGenerator->GetGeneratorTarget(linkee); + cmLocalGenerator* lg = gt->GetLocalGenerator(); + cmMakefile* mf = linkee->GetMakefile(); + std::string di = mf->GetCurrentBinaryDirectory(); + di += "/"; + di += lg->GetTargetDirectory(*linkee); + dirs.push_back(di); + } + } + } + return dirs; +} |