ENH: Speedup by storing source name without last extension
This commit is contained in:
parent
030dd4b91e
commit
826405a1b6
|
@ -1769,8 +1769,7 @@ cmSourceFile* cmMakefile::GetSource(const char* sourceName) const
|
||||||
for(std::vector<cmSourceFile*>::const_iterator i = m_SourceFiles.begin();
|
for(std::vector<cmSourceFile*>::const_iterator i = m_SourceFiles.begin();
|
||||||
i != m_SourceFiles.end(); ++i)
|
i != m_SourceFiles.end(); ++i)
|
||||||
{
|
{
|
||||||
if (cmSystemTools::GetFilenameWithoutLastExtension((*i)->GetFullPath())
|
if ((*i)->GetSourceNameWithoutLastExtension() == sname &&
|
||||||
== sname &&
|
|
||||||
cmSystemTools::GetFilenamePath((*i)->GetFullPath()) == path &&
|
cmSystemTools::GetFilenamePath((*i)->GetFullPath()) == path &&
|
||||||
(ext.size() == 0 || (ext == (*i)->GetSourceExtension())))
|
(ext.size() == 0 || (ext == (*i)->GetSourceExtension())))
|
||||||
{
|
{
|
||||||
|
|
|
@ -29,6 +29,7 @@ void cmSourceFile::SetName(const char* name, const char* dir,
|
||||||
{
|
{
|
||||||
|
|
||||||
this->SetProperty("HEADER_FILE_ONLY","1");
|
this->SetProperty("HEADER_FILE_ONLY","1");
|
||||||
|
m_SourceNameWithoutLastExtension = "";
|
||||||
|
|
||||||
|
|
||||||
m_SourceName = name;
|
m_SourceName = name;
|
||||||
|
@ -142,6 +143,7 @@ void cmSourceFile::SetName(const char* name, const char* dir, const char *ext,
|
||||||
bool hfo)
|
bool hfo)
|
||||||
{
|
{
|
||||||
this->SetProperty("HEADER_FILE_ONLY",(hfo ? "1" : "0"));
|
this->SetProperty("HEADER_FILE_ONLY",(hfo ? "1" : "0"));
|
||||||
|
m_SourceNameWithoutLastExtension = "";
|
||||||
m_SourceName = name;
|
m_SourceName = name;
|
||||||
std::string pathname = dir;
|
std::string pathname = dir;
|
||||||
if(pathname != "")
|
if(pathname != "")
|
||||||
|
@ -210,3 +212,12 @@ void cmSourceFile::SetCustomCommand(cmCustomCommand* cc)
|
||||||
}
|
}
|
||||||
m_CustomCommand = cc;
|
m_CustomCommand = cc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const std::string& cmSourceFile::GetSourceNameWithoutLastExtension()
|
||||||
|
{
|
||||||
|
if ( m_SourceNameWithoutLastExtension.empty() )
|
||||||
|
{
|
||||||
|
m_SourceNameWithoutLastExtension = cmSystemTools::GetFilenameWithoutLastExtension(m_FullPath);
|
||||||
|
}
|
||||||
|
return m_SourceNameWithoutLastExtension;
|
||||||
|
}
|
||||||
|
|
|
@ -101,6 +101,11 @@ public:
|
||||||
const std::vector<std::string> &GetDepends() const {return m_Depends;}
|
const std::vector<std::string> &GetDepends() const {return m_Depends;}
|
||||||
std::vector<std::string> &GetDepends() {return m_Depends;}
|
std::vector<std::string> &GetDepends() {return m_Depends;}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the source name without last extension
|
||||||
|
*/
|
||||||
|
const std::string& GetSourceNameWithoutLastExtension();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::map<cmStdString,cmStdString> m_Properties;
|
std::map<cmStdString,cmStdString> m_Properties;
|
||||||
cmCustomCommand *m_CustomCommand;
|
cmCustomCommand *m_CustomCommand;
|
||||||
|
@ -108,6 +113,7 @@ private:
|
||||||
std::string m_SourceName;
|
std::string m_SourceName;
|
||||||
std::string m_SourceExtension;
|
std::string m_SourceExtension;
|
||||||
std::vector<std::string> m_Depends;
|
std::vector<std::string> m_Depends;
|
||||||
|
std::string m_SourceNameWithoutLastExtension;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue