summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2006-08-03 13:26:07 (GMT)
committerBrad King <brad.king@kitware.com>2006-08-03 13:26:07 (GMT)
commit88702ff4424478dac8efef80324437632584fbff (patch)
tree74830590180dc323706fbca7324241318db012bc
parente647052d4986de9cbe852faa1d79c03147cea13a (diff)
downloadCMake-88702ff4424478dac8efef80324437632584fbff.zip
CMake-88702ff4424478dac8efef80324437632584fbff.tar.gz
CMake-88702ff4424478dac8efef80324437632584fbff.tar.bz2
ENH: Moved GetSourceFileLanguage up to cmLocalGenerator.
-rw-r--r--Source/cmLocalGenerator.cxx16
-rw-r--r--Source/cmLocalGenerator.h3
-rw-r--r--Source/cmLocalUnixMakefileGenerator3.cxx16
-rw-r--r--Source/cmLocalUnixMakefileGenerator3.h6
4 files changed, 19 insertions, 22 deletions
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index e604320..fdeed5b 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -2198,3 +2198,19 @@ cmLocalGenerator::GetObjectFileNameWithoutTarget(const cmSourceFile& source)
// Convert to a safe name.
return this->CreateSafeUniqueObjectFileName(objectName.c_str());
}
+
+//----------------------------------------------------------------------------
+const char*
+cmLocalGenerator
+::GetSourceFileLanguage(const cmSourceFile& source)
+{
+ // Check for an explicitly assigned language.
+ if(const char* lang = source.GetProperty("LANGUAGE"))
+ {
+ return lang;
+ }
+
+ // Infer the language from the source file extension.
+ return (this->GlobalGenerator
+ ->GetLanguageFromExtension(source.GetSourceExtension().c_str()));
+}
diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h
index 49bae5b..ec0aafa 100644
--- a/Source/cmLocalGenerator.h
+++ b/Source/cmLocalGenerator.h
@@ -172,6 +172,9 @@ public:
/** Get the include flags for the current makefile and language. */
void GetIncludeDirectories(std::vector<std::string>& dirs);
+ /** Compute the language used to compile the given source file. */
+ const char* GetSourceFileLanguage(const cmSourceFile& source);
+
// Create a struct to hold the varibles passed into
// ExpandRuleVariables
struct RuleVariables
diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx
index 7e0cad7..dc301de 100644
--- a/Source/cmLocalUnixMakefileGenerator3.cxx
+++ b/Source/cmLocalUnixMakefileGenerator3.cxx
@@ -1897,19 +1897,3 @@ void cmLocalUnixMakefileGenerator3
}
}
}
-
-//----------------------------------------------------------------------------
-const char*
-cmLocalUnixMakefileGenerator3
-::GetSourceFileLanguage(const cmSourceFile& source)
-{
- const char* lang = source.GetProperty("LANGUAGE");
- if ( lang )
- {
- return lang;
- }
- // Identify the language of the source file.
- return (this->GlobalGenerator
- ->GetLanguageFromExtension(source.GetSourceExtension().c_str()));
-}
-
diff --git a/Source/cmLocalUnixMakefileGenerator3.h b/Source/cmLocalUnixMakefileGenerator3.h
index f83f102..9a61b30 100644
--- a/Source/cmLocalUnixMakefileGenerator3.h
+++ b/Source/cmLocalUnixMakefileGenerator3.h
@@ -174,12 +174,6 @@ public:
// cleanup the name of a potential target
std::string ConvertToMakeTarget(const char* tgt);
-
- const char* GetSourceFileLanguage(const cmSourceFile& source);
-
-
-
-
/** Called from command-line hook to scan dependencies. */
virtual bool ScanDependencies(const char* tgtInfo);