diff options
author | Brad King <brad.king@kitware.com> | 2007-12-28 16:49:46 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2007-12-28 16:49:46 (GMT) |
commit | 42f3f3c342849d48bbf00a1bca1392c4e5abb18d (patch) | |
tree | 5c800801afba3d31965ba2e9499a0aed91ce95b7 /Source | |
parent | 9528b38fbafa4085f29787f14735f065e07d9633 (diff) | |
download | CMake-42f3f3c342849d48bbf00a1bca1392c4e5abb18d.zip CMake-42f3f3c342849d48bbf00a1bca1392c4e5abb18d.tar.gz CMake-42f3f3c342849d48bbf00a1bca1392c4e5abb18d.tar.bz2 |
ENH: Store in DependInfo.cmake files a list of the corresponding files for the targets to which a target links. This is useful for locating Fortran modules provided by linked targets. See issue #5809.
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmMakefileTargetGenerator.cxx | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index d4c61cc..e780219 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -792,6 +792,37 @@ void cmMakefileTargetGenerator::WriteTargetDependRules() *this->InfoFileStream << " )\n\n"; } + // Store list of targets linked directly or transitively. + { + *this->InfoFileStream + << "\n" + << "# Targets to which this target links.\n" + << "SET(CMAKE_TARGET_LINKED_INFO_FILES\n"; + cmGlobalGenerator* gg = this->GlobalGenerator; + std::set<cmTarget const*> emitted; + cmTarget::LinkLibraryVectorType const& libs = + this->Target->GetLinkLibraries(); + for(cmTarget::LinkLibraryVectorType::const_iterator j = libs.begin(); + j != libs.end(); ++j) + { + if(cmTarget const* linkee = gg->FindTarget(0, j->first.c_str(), false)) + { + if(emitted.insert(linkee).second) + { + cmMakefile* mf = linkee->GetMakefile(); + cmLocalGenerator* lg = mf->GetLocalGenerator(); + std::string di = mf->GetStartOutputDirectory(); + di += "/"; + di += lg->GetTargetDirectory(*linkee); + di += "/DependInfo.cmake"; + *this->InfoFileStream << " \"" << di << "\"\n"; + } + } + } + *this->InfoFileStream + << " )\n"; + } + // and now write the rule to use it std::vector<std::string> depends; std::vector<std::string> commands; |