ENH: speed improvements
This commit is contained in:
parent
cdc65cfebf
commit
789267c949
|
@ -49,7 +49,7 @@ public:
|
|||
* This determines if the command gets propagated down
|
||||
* to makefiles located in subdirectories.
|
||||
*/
|
||||
virtual bool IsInherited() { return true; }
|
||||
virtual bool IsInherited() { return false; }
|
||||
|
||||
/**
|
||||
* The name of the command as specified in CMakeList.txt.
|
||||
|
|
|
@ -49,7 +49,7 @@ public:
|
|||
* This determines if the command gets propagated down
|
||||
* to makefiles located in subdirectories.
|
||||
*/
|
||||
virtual bool IsInherited() {return true;}
|
||||
virtual bool IsInherited() {return false;}
|
||||
|
||||
/**
|
||||
* The name of the command as specified in CMakeList.txt.
|
||||
|
|
|
@ -49,7 +49,7 @@ public:
|
|||
* This determines if the command gets propagated down
|
||||
* to makefiles located in subdirectories.
|
||||
*/
|
||||
virtual bool IsInherited() {return true;}
|
||||
virtual bool IsInherited() {return false;}
|
||||
|
||||
/**
|
||||
* The name of the command as specified in CMakeList.txt.
|
||||
|
|
|
@ -49,7 +49,7 @@ public:
|
|||
* This determines if the command gets propagated down
|
||||
* to makefiles located in subdirectories.
|
||||
*/
|
||||
virtual bool IsInherited() { return true; }
|
||||
virtual bool IsInherited() { return false; }
|
||||
|
||||
/**
|
||||
* The name of the command as specified in CMakeList.txt.
|
||||
|
|
|
@ -25,19 +25,21 @@ bool cmIncludeCommand::InitialPass(std::vector<std::string> const& args)
|
|||
this->SetError("called with wrong number of arguments. "
|
||||
"Include only takes one file.");
|
||||
}
|
||||
bool exists = cmSystemTools::FileExists(args[0].c_str());
|
||||
if(args.size() == 2 && args[1] == "OPTIONAL" && !exists)
|
||||
bool optional = false;
|
||||
if(args.size() == 2)
|
||||
{
|
||||
return true;
|
||||
optional = args[1] == "OPTIONAL";
|
||||
}
|
||||
if(!exists)
|
||||
|
||||
bool readit = m_Makefile->ReadListFile( m_Makefile->GetCurrentListFile(),
|
||||
args[0].c_str());
|
||||
if(!optional && !readit)
|
||||
{
|
||||
std::string error = "Include file not found: " + args[0] + "\n";
|
||||
this->SetError(error.c_str());
|
||||
std::string m = "Could not find include file:";
|
||||
m += args[0];
|
||||
this->SetError(m.c_str());
|
||||
return false;
|
||||
}
|
||||
m_Makefile->ReadListFile( m_Makefile->GetCurrentListFile(),
|
||||
args[0].c_str());
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -77,10 +77,15 @@ cmListFile* cmListFileCache::GetFileCache(const char* path)
|
|||
|
||||
bool cmListFileCache::CacheFile(const char* path)
|
||||
{
|
||||
if(!cmSystemTools::FileExists(path))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
std::ifstream fin(path);
|
||||
if(!fin)
|
||||
{
|
||||
cmSystemTools::Error("error can not open file ", path);
|
||||
cmSystemTools::Error("cmListFileCache: error can not open file ", path);
|
||||
return false;
|
||||
}
|
||||
std::string name;
|
||||
|
|
|
@ -323,7 +323,6 @@ bool cmMakefile::ReadListFile(const char* filename, const char* external)
|
|||
cmListFileCache::GetInstance()->GetFileCache(filenametoread);
|
||||
if(!lf)
|
||||
{
|
||||
cmSystemTools::Error("error can not open file ", filenametoread);
|
||||
return false;
|
||||
}
|
||||
// add this list file to the list of dependencies
|
||||
|
|
|
@ -972,61 +972,14 @@ bool cmSystemTools::FilesDiffer(const char* source,
|
|||
{
|
||||
return true;
|
||||
}
|
||||
const int buffer_length = 4096;
|
||||
char bufferSource[buffer_length];
|
||||
char bufferDest[buffer_length];
|
||||
while(finSource && finDestination)
|
||||
{
|
||||
if(finSource.getline(bufferSource, buffer_length, '\n')
|
||||
|| finSource.gcount())
|
||||
{
|
||||
if(finDestination.getline(bufferDest, buffer_length, '\n')
|
||||
|| finDestination.gcount())
|
||||
{
|
||||
// both if statements passed
|
||||
if(finSource.eof())
|
||||
{
|
||||
if(!finDestination.eof())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if(finSource.gcount() != finDestination.gcount())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if(strncmp(bufferSource, bufferDest, finSource.gcount()) != 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else if(finSource.fail())
|
||||
{
|
||||
if(!finDestination.fail())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if(strcmp(bufferSource, bufferDest) != 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
finSource.clear(finSource.rdstate() & ~std::ios::failbit);
|
||||
finDestination.clear(finDestination.rdstate() & ~std::ios::failbit);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(strcmp(bufferSource, bufferDest) != 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
char* buffer1 = new char[statSource.st_size];
|
||||
char* buffer2 = new char[statSource.st_size];
|
||||
finSource.read(buffer1, statSource.st_size);
|
||||
finDestination.read(buffer2, statSource.st_size);
|
||||
int ret = memcmp(buffer1, buffer2, statSource.st_size);
|
||||
delete [] buffer2;
|
||||
delete [] buffer1;
|
||||
return ret != 0;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -635,7 +635,7 @@ int main()
|
|||
#ifndef REGISTRY_TEST_PATH
|
||||
cmFailed("the CONFIGURE_FILE command is broken, REGISTRY_TEST_PATH is not defined.");
|
||||
#else
|
||||
if(strcmp(REGISTRY_TEST_PATH, BINARY_DIR "/registry_dir") != 0)
|
||||
if(stricmp(REGISTRY_TEST_PATH, BINARY_DIR "/registry_dir") != 0)
|
||||
{
|
||||
cmFailed("the 'read registry value' function or CONFIGURE_FILE command is broken. REGISTRY_TEST_PATH == ",
|
||||
REGISTRY_TEST_PATH);
|
||||
|
|
|
@ -635,7 +635,7 @@ int main()
|
|||
#ifndef REGISTRY_TEST_PATH
|
||||
cmFailed("the CONFIGURE_FILE command is broken, REGISTRY_TEST_PATH is not defined.");
|
||||
#else
|
||||
if(strcmp(REGISTRY_TEST_PATH, BINARY_DIR "/registry_dir") != 0)
|
||||
if(stricmp(REGISTRY_TEST_PATH, BINARY_DIR "/registry_dir") != 0)
|
||||
{
|
||||
cmFailed("the 'read registry value' function or CONFIGURE_FILE command is broken. REGISTRY_TEST_PATH == ",
|
||||
REGISTRY_TEST_PATH);
|
||||
|
|
|
@ -635,7 +635,7 @@ int main()
|
|||
#ifndef REGISTRY_TEST_PATH
|
||||
cmFailed("the CONFIGURE_FILE command is broken, REGISTRY_TEST_PATH is not defined.");
|
||||
#else
|
||||
if(strcmp(REGISTRY_TEST_PATH, BINARY_DIR "/registry_dir") != 0)
|
||||
if(stricmp(REGISTRY_TEST_PATH, BINARY_DIR "/registry_dir") != 0)
|
||||
{
|
||||
cmFailed("the 'read registry value' function or CONFIGURE_FILE command is broken. REGISTRY_TEST_PATH == ",
|
||||
REGISTRY_TEST_PATH);
|
||||
|
|
Loading…
Reference in New Issue