summaryrefslogtreecommitdiffstats
path: root/Source/cmTarget.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2007-08-02 17:38:39 (GMT)
committerBrad King <brad.king@kitware.com>2007-08-02 17:38:39 (GMT)
commit9f2de08f909350da3ebc14f124051a59ed1947c3 (patch)
treed773eed9e9015e94b2ecf74ac6fb8aef2b1c9381 /Source/cmTarget.cxx
parentdac7814841a09d80b75eba37ac50aa9ae17ced19 (diff)
downloadCMake-9f2de08f909350da3ebc14f124051a59ed1947c3.zip
CMake-9f2de08f909350da3ebc14f124051a59ed1947c3.tar.gz
CMake-9f2de08f909350da3ebc14f124051a59ed1947c3.tar.bz2
ENH: Added cmTarget::GetLanguages method to centralize computation of the list of languages compiled in a target.
Diffstat (limited to 'Source/cmTarget.cxx')
-rw-r--r--Source/cmTarget.cxx22
1 files changed, 14 insertions, 8 deletions
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index c4b6e34..18b0ad1 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -1488,14 +1488,7 @@ const char* cmTarget::GetLinkerLanguage(cmGlobalGenerator* gg)
// if the property has not yet been set, collect all languages in the
// target and then find the language with the highest preference value
std::set<cmStdString> languages;
- for(std::vector<cmSourceFile*>::const_iterator
- i = this->SourceFiles.begin(); i != this->SourceFiles.end(); ++i)
- {
- if(const char* lang = (*i)->GetLanguage())
- {
- languages.insert(lang);
- }
- }
+ this->GetLanguages(languages);
std::string linkerLangList; // only used for the error message
int maxLinkerPref = 0;
@@ -2369,3 +2362,16 @@ const char* cmTarget::GetExportMacro()
return 0;
}
}
+
+//----------------------------------------------------------------------------
+void cmTarget::GetLanguages(std::set<cmStdString>& languages) const
+{
+ for(std::vector<cmSourceFile*>::const_iterator
+ i = this->SourceFiles.begin(); i != this->SourceFiles.end(); ++i)
+ {
+ if(const char* lang = (*i)->GetLanguage())
+ {
+ languages.insert(lang);
+ }
+ }
+}