[cmake-commits] king committed cmTarget.cxx 1.158 1.159 cmTarget.h
1.89 1.90 cmMakefileTargetGenerator.cxx 1.66 1.67
cmake-commits at cmake.org
cmake-commits at cmake.org
Thu Aug 2 13:38:41 EDT 2007
Update of /cvsroot/CMake/CMake/Source
In directory public:/mounts/ram/cvs-serv32720
Modified Files:
cmTarget.cxx cmTarget.h cmMakefileTargetGenerator.cxx
Log Message:
ENH: Added cmTarget::GetLanguages method to centralize computation of the list of languages compiled in a target.
Index: cmTarget.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmTarget.h,v
retrieving revision 1.89
retrieving revision 1.90
diff -u -d -r1.89 -r1.90
--- cmTarget.h 2 Jul 2007 17:32:41 -0000 1.89
+++ cmTarget.h 2 Aug 2007 17:38:39 -0000 1.90
@@ -61,7 +61,7 @@
///! Set the cmMakefile that owns this target
void SetMakefile(cmMakefile *mf);
- cmMakefile *GetMakefile() { return this->Makefile;};
+ cmMakefile *GetMakefile() const { return this->Makefile;};
/**
* Get the list of the custom commands for this target
@@ -264,6 +264,13 @@
If no macro should be defined null is returned. */
const char* GetExportMacro();
+ // Compute the set of languages compiled by the target. This is
+ // computed every time it is called because the languages can change
+ // when source file properties are changed and we do not have enough
+ // information to forward these property changes to the targets
+ // until we have per-target object file properties.
+ void GetLanguages(std::set<cmStdString>& languages) const;
+
private:
/**
* A list of direct dependencies. Use in conjunction with DependencyMap.
Index: cmTarget.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmTarget.cxx,v
retrieving revision 1.158
retrieving revision 1.159
diff -u -d -r1.158 -r1.159
--- cmTarget.cxx 1 Aug 2007 17:04:45 -0000 1.158
+++ cmTarget.cxx 2 Aug 2007 17:38:39 -0000 1.159
@@ -1488,14 +1488,7 @@
// 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 @@
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);
+ }
+ }
+}
Index: cmMakefileTargetGenerator.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmMakefileTargetGenerator.cxx,v
retrieving revision 1.66
retrieving revision 1.67
diff -u -d -r1.66 -r1.67
--- cmMakefileTargetGenerator.cxx 2 Aug 2007 13:37:10 -0000 1.66
+++ cmMakefileTargetGenerator.cxx 2 Aug 2007 17:38:39 -0000 1.67
@@ -234,14 +234,12 @@
void cmMakefileTargetGenerator::WriteTargetLanguageFlags()
{
// write language flags for target
- std::map<cmStdString,cmLocalUnixMakefileGenerator3::IntegrityCheckSet>&
- checkSet =
- this->LocalGenerator->GetIntegrityCheckSet()[this->Target->GetName()];
- for(std::map<cmStdString,
- cmLocalUnixMakefileGenerator3::IntegrityCheckSet>::const_iterator
- l = checkSet.begin(); l != checkSet.end(); ++l)
+ std::set<cmStdString> languages;
+ this->Target->GetLanguages(languages);
+ for(std::set<cmStdString>::const_iterator l = languages.begin();
+ l != languages.end(); ++l)
{
- const char *lang = l->first.c_str();
+ const char *lang = l->c_str();
std::string flags;
bool shared = ((this->Target->GetType() == cmTarget::SHARED_LIBRARY) ||
(this->Target->GetType() == cmTarget::MODULE_LIBRARY));
More information about the Cmake-commits
mailing list