summaryrefslogtreecommitdiffstats
path: root/Source/cmSourceFile.cxx
diff options
context:
space:
mode:
authorBen Boeckel <ben.boeckel@kitware.com>2014-02-04 02:20:56 (GMT)
committerBrad King <brad.king@kitware.com>2014-03-08 18:05:30 (GMT)
commitce5114354c357df973e54872ab7abebbff36793b (patch)
tree472c096db98ba5b36c7c32910a334a044ecafd80 /Source/cmSourceFile.cxx
parent83a5e453f8c0dc0fc9b6bdee9723478aafefd0da (diff)
downloadCMake-ce5114354c357df973e54872ab7abebbff36793b.zip
CMake-ce5114354c357df973e54872ab7abebbff36793b.tar.gz
CMake-ce5114354c357df973e54872ab7abebbff36793b.tar.bz2
stringapi: Use strings for the languages
Diffstat (limited to 'Source/cmSourceFile.cxx')
-rw-r--r--Source/cmSourceFile.cxx11
1 files changed, 6 insertions, 5 deletions
diff --git a/Source/cmSourceFile.cxx b/Source/cmSourceFile.cxx
index f052044..0d37205 100644
--- a/Source/cmSourceFile.cxx
+++ b/Source/cmSourceFile.cxx
@@ -39,7 +39,7 @@ std::string const& cmSourceFile::GetExtension() const
}
//----------------------------------------------------------------------------
-const char* cmSourceFile::GetLanguage()
+std::string cmSourceFile::GetLanguage()
{
// If the language was set explicitly by the user then use it.
if(const char* lang = this->GetProperty("LANGUAGE"))
@@ -76,7 +76,7 @@ const char* cmSourceFile::GetLanguage()
}
//----------------------------------------------------------------------------
-const char* cmSourceFile::GetLanguage() const
+std::string cmSourceFile::GetLanguage() const
{
// If the language was set explicitly by the user then use it.
if(const char* lang = this->GetProperty("LANGUAGE"))
@@ -87,11 +87,11 @@ const char* cmSourceFile::GetLanguage() const
// If the language was determined from the source file extension use it.
if(!this->Language.empty())
{
- return this->Language.c_str();
+ return this->Language;
}
// The language is not known.
- return 0;
+ return "";
}
//----------------------------------------------------------------------------
@@ -267,7 +267,8 @@ void cmSourceFile::CheckLanguage(std::string const& ext)
// Try to identify the source file language from the extension.
cmMakefile const* mf = this->Location.GetMakefile();
cmGlobalGenerator* gg = mf->GetLocalGenerator()->GetGlobalGenerator();
- if(const char* l = gg->GetLanguageFromExtension(ext.c_str()))
+ std::string l = gg->GetLanguageFromExtension(ext.c_str());
+ if(!l.empty())
{
this->Language = l;
}