diff options
author | Brad King <brad.king@kitware.com> | 2017-04-19 14:47:28 +0000 |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2017-04-19 10:47:31 -0400 |
commit | 44f0d2d9913595e214048b6d5a2b9ab2e9d1cf46 (patch) | |
tree | c95b4621b9a71adc962c9c2e3e3140a0fb73e627 /Source/cmGeneratorTarget.cxx | |
parent | 9db9bb27ea3f3dd3db3913c2bc2233f03018d5b0 (diff) | |
parent | eec93bceec5411e4409b5e3ee5dc301fca6fcbfd (diff) | |
download | cmake-44f0d2d9913595e214048b6d5a2b9ab2e9d1cf46.tar.gz |
Merge topic 'objlib-extend'
eec93bce Allow OBJECT libraries to be installed, exported, and imported
93c89bc7 Genex: Allow TARGET_OBJECTS to be used everywhere
ac0cf7ff Genex: Reject TARGET_OBJECTS on non-object libraries earlier
8577978c Tests: ExportImport C code should use explicit (void) in prototypes
26cfd039 cmInstallTargetGenerator: Re-order GenerateScriptForConfig logic
25f3f22a cmGlobalGenerator: Add method to check if object file location is known
d596c550 cmGeneratorTarget: Add method to get the object file directory
930042f2 cmGeneratorTarget: Factor out a GetTargetObjectNames method
...
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !712
Diffstat (limited to 'Source/cmGeneratorTarget.cxx')
-rw-r--r-- | Source/cmGeneratorTarget.cxx | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 32e2b008aa..27995059a4 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -3274,6 +3274,46 @@ std::string cmGeneratorTarget::GetPDBName(const std::string& config) const return prefix + base + ".pdb"; } +std::string cmGeneratorTarget::GetObjectDirectory( + std::string const& config) const +{ + std::string obj_dir = + this->GlobalGenerator->ExpandCFGIntDir(this->ObjectDirectory, config); +#if defined(__APPLE__) + // find and replace $(PROJECT_NAME) xcode placeholder + const std::string projectName = this->LocalGenerator->GetProjectName(); + cmSystemTools::ReplaceString(obj_dir, "$(PROJECT_NAME)", projectName); +#endif + return obj_dir; +} + +void cmGeneratorTarget::GetTargetObjectNames( + std::string const& config, std::vector<std::string>& objects) const +{ + std::vector<cmSourceFile const*> objectSources; + this->GetObjectSources(objectSources, config); + std::map<cmSourceFile const*, std::string> mapping; + + for (std::vector<cmSourceFile const*>::const_iterator it = + objectSources.begin(); + it != objectSources.end(); ++it) { + mapping[*it]; + } + + this->LocalGenerator->ComputeObjectFilenames(mapping, this); + + for (std::vector<cmSourceFile const*>::const_iterator it = + objectSources.begin(); + it != objectSources.end(); ++it) { + // Find the object file name corresponding to this source file. + std::map<cmSourceFile const*, std::string>::const_iterator map_it = + mapping.find(*it); + // It must exist because we populated the mapping just above. + assert(!map_it->second.empty()); + objects.push_back(map_it->second); + } +} + bool cmGeneratorTarget::StrictTargetComparison::operator()( cmGeneratorTarget const* t1, cmGeneratorTarget const* t2) const { |