STYLE: Fix some style issues

This commit is contained in:
Andy Cedilnik 2006-03-10 13:06:26 -05:00
parent f01afc89f5
commit 634343c3e8
41 changed files with 978 additions and 844 deletions

View File

@ -39,7 +39,7 @@ cmCPackGenerators::cmCPackGenerators()
cmCPackGenerators::~cmCPackGenerators() cmCPackGenerators::~cmCPackGenerators()
{ {
std::vector<cmCPackGenericGenerator*>::iterator it; std::vector<cmCPackGenericGenerator*>::iterator it;
for ( it = m_Generators.begin(); it != m_Generators.end(); ++ it ) for ( it = this->Generators.begin(); it != this->Generators.end(); ++ it )
{ {
delete *it; delete *it;
} }
@ -53,8 +53,8 @@ cmCPackGenericGenerator* cmCPackGenerators::NewGenerator(const char* name)
{ {
return 0; return 0;
} }
m_Generators.push_back(gen); this->Generators.push_back(gen);
gen->SetLogger(m_Logger); gen->SetLogger(this->Logger);
return gen; return gen;
} }
@ -67,8 +67,8 @@ cmCPackGenericGenerator* cmCPackGenerators::NewGeneratorInternal(
return 0; return 0;
} }
cmCPackGenerators::t_GeneratorCreatorsMap::iterator it cmCPackGenerators::t_GeneratorCreatorsMap::iterator it
= m_GeneratorCreators.find(name); = this->GeneratorCreators.find(name);
if ( it == m_GeneratorCreators.end() ) if ( it == this->GeneratorCreators.end() )
{ {
return 0; return 0;
} }
@ -81,9 +81,9 @@ void cmCPackGenerators::RegisterGenerator(const char* name,
{ {
if ( !name || !createGenerator ) if ( !name || !createGenerator )
{ {
cmCPack_Log(m_Logger, cmCPackLog::LOG_ERROR, "Cannot register generator" cmCPack_Log(this->Logger, cmCPackLog::LOG_ERROR,
<< std::endl); "Cannot register generator" << std::endl);
return; return;
} }
m_GeneratorCreators[name] = createGenerator; this->GeneratorCreators[name] = createGenerator;
} }

View File

@ -44,15 +44,15 @@ public:
void RegisterGenerator(const char* name, void RegisterGenerator(const char* name,
CreateGeneratorCall* createGenerator); CreateGeneratorCall* createGenerator);
void SetLogger(cmCPackLog* logger) { m_Logger = logger; } void SetLogger(cmCPackLog* logger) { this->Logger = logger; }
private: private:
cmCPackGenericGenerator* NewGeneratorInternal(const char* name); cmCPackGenericGenerator* NewGeneratorInternal(const char* name);
std::vector<cmCPackGenericGenerator*> m_Generators; std::vector<cmCPackGenericGenerator*> Generators;
typedef std::map<cmStdString, CreateGeneratorCall*> t_GeneratorCreatorsMap; typedef std::map<cmStdString, CreateGeneratorCall*> t_GeneratorCreatorsMap;
t_GeneratorCreatorsMap m_GeneratorCreators; t_GeneratorCreatorsMap GeneratorCreators;
cmCPackLog* m_Logger; cmCPackLog* Logger;
}; };
#endif #endif

View File

@ -31,21 +31,21 @@
//---------------------------------------------------------------------- //----------------------------------------------------------------------
cmCPackGenericGenerator::cmCPackGenericGenerator() cmCPackGenericGenerator::cmCPackGenericGenerator()
{ {
m_GeneratorVerbose = false; this->GeneratorVerbose = false;
m_MakefileMap = 0; this->MakefileMap = 0;
m_Logger = 0; this->Logger = 0;
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
cmCPackGenericGenerator::~cmCPackGenericGenerator() cmCPackGenericGenerator::~cmCPackGenericGenerator()
{ {
m_MakefileMap = 0; this->MakefileMap = 0;
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
int cmCPackGenericGenerator::PrepareNames() int cmCPackGenericGenerator::PrepareNames()
{ {
this->SetOption("CPACK_GENERATOR", m_Name.c_str()); this->SetOption("CPACK_GENERATOR", this->Name.c_str());
std::string tempDirectory = this->GetOption("CPACK_PACKAGE_DIRECTORY"); std::string tempDirectory = this->GetOption("CPACK_PACKAGE_DIRECTORY");
tempDirectory += "/_CPack_Packages/"; tempDirectory += "/_CPack_Packages/";
tempDirectory += this->GetOption("CPACK_GENERATOR"); tempDirectory += this->GetOption("CPACK_GENERATOR");
@ -157,7 +157,7 @@ int cmCPackGenericGenerator::InstallProject()
std::string output; std::string output;
int retVal = 1; int retVal = 1;
bool resB = cmSystemTools::RunSingleCommand(it->c_str(), &output, bool resB = cmSystemTools::RunSingleCommand(it->c_str(), &output,
&retVal, 0, m_GeneratorVerbose, 0); &retVal, 0, this->GeneratorVerbose, 0);
if ( !resB || retVal ) if ( !resB || retVal )
{ {
std::string tmpFile = this->GetOption("CPACK_TOPLEVEL_DIRECTORY"); std::string tmpFile = this->GetOption("CPACK_TOPLEVEL_DIRECTORY");
@ -272,12 +272,12 @@ void cmCPackGenericGenerator::SetOption(const char* op, const char* value)
} }
if ( !value ) if ( !value )
{ {
m_MakefileMap->RemoveDefinition(op); this->MakefileMap->RemoveDefinition(op);
return; return;
} }
cmCPackLogger(cmCPackLog::LOG_DEBUG, this->GetNameOfClass() cmCPackLogger(cmCPackLog::LOG_DEBUG, this->GetNameOfClass()
<< "::SetOption(" << op << ", " << value << ")" << std::endl); << "::SetOption(" << op << ", " << value << ")" << std::endl);
m_MakefileMap->AddDefinition(op, value); this->MakefileMap->AddDefinition(op, value);
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@ -346,15 +346,15 @@ int cmCPackGenericGenerator::ProcessGenerator()
//---------------------------------------------------------------------- //----------------------------------------------------------------------
int cmCPackGenericGenerator::Initialize(const char* name, cmMakefile* mf) int cmCPackGenericGenerator::Initialize(const char* name, cmMakefile* mf)
{ {
m_MakefileMap = mf; this->MakefileMap = mf;
m_Name = name; this->Name = name;
return 1; return 1;
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
const char* cmCPackGenericGenerator::GetOption(const char* op) const char* cmCPackGenericGenerator::GetOption(const char* op)
{ {
return m_MakefileMap->GetDefinition(op); return this->MakefileMap->GetDefinition(op);
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@ -363,18 +363,18 @@ int cmCPackGenericGenerator::FindRunningCMake(const char* arg0)
int found = 0; int found = 0;
// Find our own executable. // Find our own executable.
std::vector<cmStdString> failures; std::vector<cmStdString> failures;
m_CPackSelf = arg0; this->CPackSelf = arg0;
cmSystemTools::ConvertToUnixSlashes(m_CPackSelf); cmSystemTools::ConvertToUnixSlashes(this->CPackSelf);
failures.push_back(m_CPackSelf); failures.push_back(this->CPackSelf);
m_CPackSelf = cmSystemTools::FindProgram(m_CPackSelf.c_str()); this->CPackSelf = cmSystemTools::FindProgram(this->CPackSelf.c_str());
if(!cmSystemTools::FileExists(m_CPackSelf.c_str())) if(!cmSystemTools::FileExists(this->CPackSelf.c_str()))
{ {
failures.push_back(m_CPackSelf); failures.push_back(this->CPackSelf);
m_CPackSelf = "/usr/local/bin/ctest"; this->CPackSelf = "/usr/local/bin/ctest";
} }
if(!cmSystemTools::FileExists(m_CPackSelf.c_str())) if(!cmSystemTools::FileExists(this->CPackSelf.c_str()))
{ {
failures.push_back(m_CPackSelf); failures.push_back(this->CPackSelf);
cmOStringStream msg; cmOStringStream msg;
msg << "CTEST can not find the command line program ctest.\n"; msg << "CTEST can not find the command line program ctest.\n";
msg << " argv[0] = \"" << arg0 << "\"\n"; msg << " argv[0] = \"" << arg0 << "\"\n";
@ -388,33 +388,33 @@ int cmCPackGenericGenerator::FindRunningCMake(const char* arg0)
} }
std::string dir; std::string dir;
std::string file; std::string file;
if(cmSystemTools::SplitProgramPath(m_CPackSelf.c_str(), if(cmSystemTools::SplitProgramPath(this->CPackSelf.c_str(),
dir, file, true)) dir, file, true))
{ {
m_CMakeSelf = dir += "/cmake"; this->CMakeSelf = dir += "/cmake";
m_CMakeSelf += cmSystemTools::GetExecutableExtension(); this->CMakeSelf += cmSystemTools::GetExecutableExtension();
if(cmSystemTools::FileExists(m_CMakeSelf.c_str())) if(cmSystemTools::FileExists(this->CMakeSelf.c_str()))
{ {
found = 1; found = 1;
} }
} }
if ( !found ) if ( !found )
{ {
failures.push_back(m_CMakeSelf); failures.push_back(this->CMakeSelf);
#ifdef CMAKE_BUILD_DIR #ifdef CMAKE_BUILD_DIR
std::string intdir = "."; std::string intdir = ".";
#ifdef CMAKE_INTDIR #ifdef CMAKE_INTDIR
intdir = CMAKE_INTDIR; intdir = CMAKE_INTDIR;
#endif #endif
m_CMakeSelf = CMAKE_BUILD_DIR; this->CMakeSelf = CMAKE_BUILD_DIR;
m_CMakeSelf += "/bin/"; this->CMakeSelf += "/bin/";
m_CMakeSelf += intdir; this->CMakeSelf += intdir;
m_CMakeSelf += "/cmake"; this->CMakeSelf += "/cmake";
m_CMakeSelf += cmSystemTools::GetExecutableExtension(); this->CMakeSelf += cmSystemTools::GetExecutableExtension();
#endif #endif
if(!cmSystemTools::FileExists(m_CMakeSelf.c_str())) if(!cmSystemTools::FileExists(this->CMakeSelf.c_str()))
{ {
failures.push_back(m_CMakeSelf); failures.push_back(this->CMakeSelf);
cmOStringStream msg; cmOStringStream msg;
msg << "CTEST can not find the command line program cmake.\n"; msg << "CTEST can not find the command line program cmake.\n";
msg << " argv[0] = \"" << arg0 << "\"\n"; msg << " argv[0] = \"" << arg0 << "\"\n";
@ -439,7 +439,7 @@ int cmCPackGenericGenerator::FindRunningCMake(const char* arg0)
if(modules.empty() || !cmSystemTools::FileExists(modules.c_str())) if(modules.empty() || !cmSystemTools::FileExists(modules.c_str()))
{ {
// next try exe/.. // next try exe/..
cMakeRoot = cmSystemTools::GetProgramPath(m_CMakeSelf.c_str()); cMakeRoot = cmSystemTools::GetProgramPath(this->CMakeSelf.c_str());
std::string::size_type slashPos = cMakeRoot.rfind("/"); std::string::size_type slashPos = cMakeRoot.rfind("/");
if(slashPos != std::string::npos) if(slashPos != std::string::npos)
{ {
@ -482,7 +482,7 @@ int cmCPackGenericGenerator::FindRunningCMake(const char* arg0)
if (!cmSystemTools::FileExists(modules.c_str())) if (!cmSystemTools::FileExists(modules.c_str()))
{ {
// try // try
cMakeRoot = cmSystemTools::GetProgramPath(m_CMakeSelf.c_str()); cMakeRoot = cmSystemTools::GetProgramPath(this->CMakeSelf.c_str());
cMakeRoot += CMAKE_DATA_DIR; cMakeRoot += CMAKE_DATA_DIR;
modules = cMakeRoot + "/Modules/CMake.cmake"; modules = cMakeRoot + "/Modules/CMake.cmake";
cmCPackLogger(cmCPackLog::LOG_DEBUG, "Looking for CMAKE_ROOT: " cmCPackLogger(cmCPackLog::LOG_DEBUG, "Looking for CMAKE_ROOT: "
@ -491,7 +491,7 @@ int cmCPackGenericGenerator::FindRunningCMake(const char* arg0)
if(!cmSystemTools::FileExists(modules.c_str())) if(!cmSystemTools::FileExists(modules.c_str()))
{ {
// next try exe // next try exe
cMakeRoot = cmSystemTools::GetProgramPath(m_CMakeSelf.c_str()); cMakeRoot = cmSystemTools::GetProgramPath(this->CMakeSelf.c_str());
// is there no Modules direcory there? // is there no Modules direcory there?
modules = cMakeRoot + "/Modules/CMake.cmake"; modules = cMakeRoot + "/Modules/CMake.cmake";
cmCPackLogger(cmCPackLog::LOG_DEBUG, "Looking for CMAKE_ROOT: " cmCPackLogger(cmCPackLog::LOG_DEBUG, "Looking for CMAKE_ROOT: "
@ -506,10 +506,10 @@ int cmCPackGenericGenerator::FindRunningCMake(const char* arg0)
cMakeRoot.c_str()); cMakeRoot.c_str());
return 0; return 0;
} }
m_CMakeRoot = cMakeRoot; this->CMakeRoot = cMakeRoot;
cmCPackLogger(cmCPackLog::LOG_DEBUG, "Looking for CMAKE_ROOT: " cmCPackLogger(cmCPackLog::LOG_DEBUG, "Looking for CMAKE_ROOT: "
<< m_CMakeRoot.c_str() << std::endl); << this->CMakeRoot.c_str() << std::endl);
this->SetOption("CMAKE_ROOT", m_CMakeRoot.c_str()); this->SetOption("CMAKE_ROOT", this->CMakeRoot.c_str());
return 1; return 1;
} }
@ -526,34 +526,34 @@ int cmCPackGenericGenerator::CompressFiles(const char* outFileName,
//---------------------------------------------------------------------- //----------------------------------------------------------------------
const char* cmCPackGenericGenerator::GetInstallPath() const char* cmCPackGenericGenerator::GetInstallPath()
{ {
if ( !m_InstallPath.empty() ) if ( !this->InstallPath.empty() )
{ {
return m_InstallPath.c_str(); return this->InstallPath.c_str();
} }
#if defined(_WIN32) && !defined(__CYGWIN__) #if defined(_WIN32) && !defined(__CYGWIN__)
const char* prgfiles = cmsys::SystemTools::GetEnv("ProgramFiles"); const char* prgfiles = cmsys::SystemTools::GetEnv("ProgramFiles");
const char* sysDrive = cmsys::SystemTools::GetEnv("SystemDrive"); const char* sysDrive = cmsys::SystemTools::GetEnv("SystemDrive");
if ( prgfiles ) if ( prgfiles )
{ {
m_InstallPath = prgfiles; this->InstallPath = prgfiles;
} }
else if ( sysDrive ) else if ( sysDrive )
{ {
m_InstallPath = sysDrive; this->InstallPath = sysDrive;
m_InstallPath += "/Program Files"; this->InstallPath += "/Program Files";
} }
else else
{ {
m_InstallPath = "c:/Program Files"; this->InstallPath = "c:/Program Files";
} }
m_InstallPath += "/"; this->InstallPath += "/";
m_InstallPath += this->GetOption("CPACK_PACKAGE_NAME"); this->InstallPath += this->GetOption("CPACK_PACKAGE_NAME");
m_InstallPath += "-"; this->InstallPath += "-";
m_InstallPath += this->GetOption("CPACK_PACKAGE_VERSION"); this->InstallPath += this->GetOption("CPACK_PACKAGE_VERSION");
#else #else
m_InstallPath = "/usr/local/"; this->InstallPath = "/usr/local/";
#endif #endif
return m_InstallPath.c_str(); return this->InstallPath.c_str();
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@ -561,7 +561,7 @@ std::string cmCPackGenericGenerator::FindTemplate(const char* name)
{ {
cmCPackLogger(cmCPackLog::LOG_DEBUG, "Look for template: " cmCPackLogger(cmCPackLog::LOG_DEBUG, "Look for template: "
<< name << std::endl); << name << std::endl);
std::string ffile = m_MakefileMap->GetModulesFile(name); std::string ffile = this->MakefileMap->GetModulesFile(name);
cmCPackLogger(cmCPackLog::LOG_DEBUG, "Found template: " cmCPackLogger(cmCPackLog::LOG_DEBUG, "Found template: "
<< ffile.c_str() << std::endl); << ffile.c_str() << std::endl);
return ffile; return ffile;
@ -571,6 +571,6 @@ std::string cmCPackGenericGenerator::FindTemplate(const char* name)
bool cmCPackGenericGenerator::ConfigureFile(const char* inName, bool cmCPackGenericGenerator::ConfigureFile(const char* inName,
const char* outName) const char* outName)
{ {
return m_MakefileMap->ConfigureFile(inName, outName, return this->MakefileMap->ConfigureFile(inName, outName,
false, true, false) == 1; false, true, false) == 1;
} }

View File

@ -29,7 +29,7 @@
do { \ do { \
cmOStringStream cmCPackLog_msg; \ cmOStringStream cmCPackLog_msg; \
cmCPackLog_msg << msg; \ cmCPackLog_msg << msg; \
m_Logger->Log(logType, __FILE__, __LINE__, cmCPackLog_msg.str().c_str());\ this->Logger->Log(logType, __FILE__, __LINE__, cmCPackLog_msg.str().c_str());\
} while ( 0 ) } while ( 0 )
#ifdef cerr #ifdef cerr
@ -56,7 +56,7 @@ public:
/** /**
* If verbose then more informaiton is printed out * If verbose then more informaiton is printed out
*/ */
void SetVerbose(bool val) { m_GeneratorVerbose = val; } void SetVerbose(bool val) { this->GeneratorVerbose = val; }
/** /**
* Do the actual processing. Subclass has to override it. * Do the actual processing. Subclass has to override it.
@ -83,7 +83,7 @@ public:
int FindRunningCMake(const char* arg0); int FindRunningCMake(const char* arg0);
//! Set the logger //! Set the logger
void SetLogger(cmCPackLog* log) { m_Logger = log; } void SetLogger(cmCPackLog* log) { this->Logger = log; }
protected: protected:
int PrepareNames(); int PrepareNames();
@ -99,19 +99,19 @@ protected:
virtual std::string FindTemplate(const char* name); virtual std::string FindTemplate(const char* name);
virtual bool ConfigureFile(const char* inName, const char* outName); virtual bool ConfigureFile(const char* inName, const char* outName);
bool m_GeneratorVerbose; bool GeneratorVerbose;
std::string m_Name; std::string Name;
std::string m_InstallPath; std::string InstallPath;
std::string m_CPackSelf; std::string CPackSelf;
std::string m_CMakeSelf; std::string CMakeSelf;
std::string m_CMakeRoot; std::string CMakeRoot;
cmCPackLog* m_Logger; cmCPackLog* Logger;
private: private:
cmMakefile* m_MakefileMap; cmMakefile* MakefileMap;
}; };
#endif #endif

View File

@ -22,19 +22,19 @@
//---------------------------------------------------------------------- //----------------------------------------------------------------------
cmCPackLog::cmCPackLog() cmCPackLog::cmCPackLog()
{ {
m_Verbose = false; this->Verbose = false;
m_Debug = false; this->Debug = false;
m_Quiet = false; this->Quiet = false;
m_NewLine = true; this->NewLine = true;
m_LastTag = cmCPackLog::NOTAG; this->LastTag = cmCPackLog::NOTAG;
#undef cerr #undef cerr
#undef cout #undef cout
m_DefaultOutput = &std::cout; this->DefaultOutput = &std::cout;
m_DefaultError = &std::cerr; this->DefaultError = &std::cerr;
m_LogOutput = 0; this->LogOutput = 0;
m_LogOutputCleanup = false; this->LogOutputCleanup = false;
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@ -46,12 +46,12 @@ cmCPackLog::~cmCPackLog()
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void cmCPackLog::SetLogOutputStream(std::ostream* os) void cmCPackLog::SetLogOutputStream(std::ostream* os)
{ {
if ( m_LogOutputCleanup && m_LogOutput ) if ( this->LogOutputCleanup && this->LogOutput )
{ {
delete m_LogOutput; delete this->LogOutput;
} }
m_LogOutputCleanup = false; this->LogOutputCleanup = false;
m_LogOutput = os; this->LogOutput = os;
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@ -72,7 +72,7 @@ bool cmCPackLog::SetLogOutputFile(const char* fname)
{ {
return false; return false;
} }
m_LogOutputCleanup = true; this->LogOutputCleanup = true;
return true; return true;
} }
@ -84,7 +84,7 @@ void cmCPackLog::Log(int tag, const char* file, int line,
bool display = false; bool display = false;
// Display file and line number if debug // Display file and line number if debug
bool useFileAndLine = m_Debug; bool useFileAndLine = this->Debug;
bool output = false; bool output = false;
bool debug = false; bool debug = false;
@ -95,7 +95,7 @@ void cmCPackLog::Log(int tag, const char* file, int line,
// When writing in file, add list of tags whenever tag changes. // When writing in file, add list of tags whenever tag changes.
std::string tagString; std::string tagString;
bool needTagString = false; bool needTagString = false;
if ( m_LogOutput && m_LastTag != tag ) if ( this->LogOutput && this->LastTag != tag )
{ {
needTagString = true; needTagString = true;
} }
@ -130,7 +130,7 @@ void cmCPackLog::Log(int tag, const char* file, int line,
tagString = "ERROR"; tagString = "ERROR";
} }
} }
if ( tag & LOG_DEBUG && m_Debug ) if ( tag & LOG_DEBUG && this->Debug )
{ {
debug = true; debug = true;
display = true; display = true;
@ -141,7 +141,7 @@ void cmCPackLog::Log(int tag, const char* file, int line,
} }
useFileAndLine = true; useFileAndLine = true;
} }
if ( tag & LOG_VERBOSE && m_Verbose ) if ( tag & LOG_VERBOSE && this->Verbose )
{ {
verbose = true; verbose = true;
display = true; display = true;
@ -151,73 +151,74 @@ void cmCPackLog::Log(int tag, const char* file, int line,
tagString = "VERBOSE"; tagString = "VERBOSE";
} }
} }
if ( m_Quiet ) if ( this->Quiet )
{ {
display = false; display = false;
} }
if ( m_LogOutput ) if ( this->LogOutput )
{ {
if ( needTagString ) if ( needTagString )
{ {
*m_LogOutput << "[" << file << ":" << line << " " << tagString << "] "; *this->LogOutput << "[" << file << ":" << line << " "
<< tagString << "] ";
} }
m_LogOutput->write(msg, length); this->LogOutput->write(msg, length);
} }
m_LastTag = tag; this->LastTag = tag;
if ( !display ) if ( !display )
{ {
return; return;
} }
if ( m_NewLine ) if ( this->NewLine )
{ {
if ( error && !m_ErrorPrefix.empty() ) if ( error && !this->ErrorPrefix.empty() )
{ {
*m_DefaultError << m_ErrorPrefix.c_str(); *this->DefaultError << this->ErrorPrefix.c_str();
} }
else if ( warning && !m_WarningPrefix.empty() ) else if ( warning && !this->WarningPrefix.empty() )
{ {
*m_DefaultError << m_WarningPrefix.c_str(); *this->DefaultError << this->WarningPrefix.c_str();
} }
else if ( output && !m_OutputPrefix.empty() ) else if ( output && !this->OutputPrefix.empty() )
{ {
*m_DefaultOutput << m_OutputPrefix.c_str(); *this->DefaultOutput << this->OutputPrefix.c_str();
} }
else if ( verbose && !m_VerbosePrefix.empty() ) else if ( verbose && !this->VerbosePrefix.empty() )
{ {
*m_DefaultOutput << m_VerbosePrefix.c_str(); *this->DefaultOutput << this->VerbosePrefix.c_str();
} }
else if ( debug && !m_DebugPrefix.empty() ) else if ( debug && !this->DebugPrefix.empty() )
{ {
*m_DefaultOutput << m_DebugPrefix.c_str(); *this->DefaultOutput << this->DebugPrefix.c_str();
} }
else if ( !m_Prefix.empty() ) else if ( !this->Prefix.empty() )
{ {
*m_DefaultOutput << m_Prefix.c_str(); *this->DefaultOutput << this->Prefix.c_str();
} }
if ( useFileAndLine ) if ( useFileAndLine )
{ {
if ( error || warning ) if ( error || warning )
{ {
*m_DefaultError << file << ":" << line << " "; *this->DefaultError << file << ":" << line << " ";
} }
else else
{ {
*m_DefaultOutput << file << ":" << line << " "; *this->DefaultOutput << file << ":" << line << " ";
} }
} }
} }
if ( error || warning ) if ( error || warning )
{ {
m_DefaultError->write(msg, length); this->DefaultError->write(msg, length);
m_DefaultError->flush(); this->DefaultError->flush();
} }
else else
{ {
m_DefaultOutput->write(msg, length); this->DefaultOutput->write(msg, length);
m_DefaultOutput->flush(); this->DefaultOutput->flush();
} }
if ( msg[length-1] == '\n' || length > 2 ) if ( msg[length-1] == '\n' || length > 2 )
{ {
m_NewLine = true; this->NewLine = true;
} }
} }

View File

@ -78,26 +78,26 @@ public:
//! Set Verbose //! Set Verbose
void VerboseOn() { this->SetVerbose(true); } void VerboseOn() { this->SetVerbose(true); }
void VerboseOff() { this->SetVerbose(true); } void VerboseOff() { this->SetVerbose(true); }
void SetVerbose(bool verb) { m_Verbose = verb; } void SetVerbose(bool verb) { this->Verbose = verb; }
bool GetVerbose() { return m_Verbose; } bool GetVerbose() { return this->Verbose; }
//! Set Debug //! Set Debug
void DebugOn() { this->SetDebug(true); } void DebugOn() { this->SetDebug(true); }
void DebugOff() { this->SetDebug(true); } void DebugOff() { this->SetDebug(true); }
void SetDebug(bool verb) { m_Debug = verb; } void SetDebug(bool verb) { this->Debug = verb; }
bool GetDebug() { return m_Debug; } bool GetDebug() { return this->Debug; }
//! Set Quiet //! Set Quiet
void QuietOn() { this->SetQuiet(true); } void QuietOn() { this->SetQuiet(true); }
void QuietOff() { this->SetQuiet(true); } void QuietOff() { this->SetQuiet(true); }
void SetQuiet(bool verb) { m_Quiet = verb; } void SetQuiet(bool verb) { this->Quiet = verb; }
bool GetQuiet() { return m_Quiet; } bool GetQuiet() { return this->Quiet; }
//! Set the output stream //! Set the output stream
void SetOutputStream(std::ostream* os) { m_DefaultOutput = os; } void SetOutputStream(std::ostream* os) { this->DefaultOutput = os; }
//! Set the error stream //! Set the error stream
void SetErrorStream(std::ostream* os) { m_DefaultError = os; } void SetErrorStream(std::ostream* os) { this->DefaultError = os; }
//! Set the log output stream //! Set the log output stream
void SetLogOutputStream(std::ostream* os); void SetLogOutputStream(std::ostream* os);
@ -108,36 +108,36 @@ public:
//! Set the various prefixes for the logging. SetPrefix sets the generic //! Set the various prefixes for the logging. SetPrefix sets the generic
// prefix that overwrittes missing ones. // prefix that overwrittes missing ones.
void SetPrefix(std::string pfx) { m_Prefix = pfx; } void SetPrefix(std::string pfx) { this->Prefix = pfx; }
void SetOutputPrefix(std::string pfx) { m_OutputPrefix = pfx; } void SetOutputPrefix(std::string pfx) { this->OutputPrefix = pfx; }
void SetVerbosePrefix(std::string pfx) { m_VerbosePrefix = pfx; } void SetVerbosePrefix(std::string pfx) { this->VerbosePrefix = pfx; }
void SetDebugPrefix(std::string pfx) { m_DebugPrefix = pfx; } void SetDebugPrefix(std::string pfx) { this->DebugPrefix = pfx; }
void SetWarningPrefix(std::string pfx) { m_WarningPrefix = pfx; } void SetWarningPrefix(std::string pfx) { this->WarningPrefix = pfx; }
void SetErrorPrefix(std::string pfx) { m_ErrorPrefix = pfx; } void SetErrorPrefix(std::string pfx) { this->ErrorPrefix = pfx; }
private: private:
bool m_Verbose; bool Verbose;
bool m_Debug; bool Debug;
bool m_Quiet; bool Quiet;
bool m_NewLine; bool NewLine;
int m_LastTag; int LastTag;
std::string m_Prefix; std::string Prefix;
std::string m_OutputPrefix; std::string OutputPrefix;
std::string m_VerbosePrefix; std::string VerbosePrefix;
std::string m_DebugPrefix; std::string DebugPrefix;
std::string m_WarningPrefix; std::string WarningPrefix;
std::string m_ErrorPrefix; std::string ErrorPrefix;
std::ostream *m_DefaultOutput; std::ostream *DefaultOutput;
std::ostream *m_DefaultError; std::ostream *DefaultError;
std::string m_LogOutputFileName; std::string LogOutputFileName;
std::ostream *m_LogOutput; std::ostream *LogOutput;
// Do we need to cleanup log output stream // Do we need to cleanup log output stream
bool m_LogOutputCleanup; bool LogOutputCleanup;
}; };
class cmCPackLogWrite class cmCPackLogWrite

View File

@ -99,7 +99,7 @@ int cmCPackNSISGenerator::CompressFiles(const char* outFileName,
std::string output; std::string output;
int retVal = 1; int retVal = 1;
bool res = cmSystemTools::RunSingleCommand(nsisCmd.c_str(), &output, bool res = cmSystemTools::RunSingleCommand(nsisCmd.c_str(), &output,
&retVal, 0, m_GeneratorVerbose, 0); &retVal, 0, this->GeneratorVerbose, 0);
if ( !res || retVal ) if ( !res || retVal )
{ {
cmGeneratedFileStream ofs(tmpFile.c_str()); cmGeneratedFileStream ofs(tmpFile.c_str());
@ -147,7 +147,7 @@ int cmCPackNSISGenerator::Initialize(const char* name, cmMakefile* mf)
std::string output; std::string output;
int retVal = 1; int retVal = 1;
bool resS = cmSystemTools::RunSingleCommand(nsisCmd.c_str(), bool resS = cmSystemTools::RunSingleCommand(nsisCmd.c_str(),
&output, &retVal, 0, m_GeneratorVerbose, 0); &output, &retVal, 0, this->GeneratorVerbose, 0);
cmsys::RegularExpression versionRex("v([0-9]+.[0-9]+)"); cmsys::RegularExpression versionRex("v([0-9]+.[0-9]+)");
if ( !resS || retVal || !versionRex.find(output)) if ( !resS || retVal || !versionRex.find(output))

View File

@ -95,7 +95,7 @@ int cmCPackPackageMakerGenerator::CompressFiles(const char* outFileName,
std::string output; std::string output;
int retVal = 1; int retVal = 1;
//bool res = cmSystemTools::RunSingleCommand(pkgCmd.str().c_str(), &output, //bool res = cmSystemTools::RunSingleCommand(pkgCmd.str().c_str(), &output,
//&retVal, 0, m_GeneratorVerbose, 0); //&retVal, 0, this->GeneratorVerbose, 0);
bool res = true; bool res = true;
retVal = system(pkgCmd.str().c_str()); retVal = system(pkgCmd.str().c_str());
cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Done running package maker" cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Done running package maker"
@ -120,7 +120,7 @@ int cmCPackPackageMakerGenerator::CompressFiles(const char* outFileName,
<< "\" create -ov -format UDZO -srcfolder \"" << packageDirFileName << "\" create -ov -format UDZO -srcfolder \"" << packageDirFileName
<< "\" \"" << outFileName << "\""; << "\" \"" << outFileName << "\"";
res = cmSystemTools::RunSingleCommand(dmgCmd.str().c_str(), &output, res = cmSystemTools::RunSingleCommand(dmgCmd.str().c_str(), &output,
&retVal, 0, m_GeneratorVerbose, 0); &retVal, 0, this->GeneratorVerbose, 0);
if ( !res || retVal ) if ( !res || retVal )
{ {
cmGeneratedFileStream ofs(tmpFile.c_str()); cmGeneratedFileStream ofs(tmpFile.c_str());

View File

@ -60,13 +60,13 @@ class cmCPackTGZ_Data
public: public:
cmCPackTGZ_Data(cmCPackTGZGenerator* gen) : cmCPackTGZ_Data(cmCPackTGZGenerator* gen) :
OutputStream(0), Generator(gen), OutputStream(0), Generator(gen),
m_CompressionLevel(Z_DEFAULT_COMPRESSION) {} CompressionLevel(Z_DEFAULT_COMPRESSION) {}
std::ostream* OutputStream; std::ostream* OutputStream;
cmCPackTGZGenerator* Generator; cmCPackTGZGenerator* Generator;
char m_CompressedBuffer[cmCPackTGZ_Data_BlockSize]; char CompressedBuffer[cmCPackTGZ_Data_BlockSize];
int m_CompressionLevel; int CompressionLevel;
z_stream m_ZLibStream; z_stream ZLibStream;
uLong m_CRC; uLong CRC;
}; };
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@ -84,11 +84,11 @@ int cmCPackTGZ_Data_Open(void *client_data, const char* pathname,
{ {
cmCPackTGZ_Data *mydata = (cmCPackTGZ_Data*)client_data; cmCPackTGZ_Data *mydata = (cmCPackTGZ_Data*)client_data;
mydata->m_ZLibStream.zalloc = Z_NULL; mydata->ZLibStream.zalloc = Z_NULL;
mydata->m_ZLibStream.zfree = Z_NULL; mydata->ZLibStream.zfree = Z_NULL;
mydata->m_ZLibStream.opaque = Z_NULL; mydata->ZLibStream.opaque = Z_NULL;
int strategy = Z_DEFAULT_STRATEGY; int strategy = Z_DEFAULT_STRATEGY;
if ( deflateInit2(&mydata->m_ZLibStream, mydata->m_CompressionLevel, if ( deflateInit2(&mydata->ZLibStream, mydata->CompressionLevel,
Z_DEFLATED, -MAX_WBITS, DEF_MEM_LEVEL, strategy) != Z_OK ) Z_DEFLATED, -MAX_WBITS, DEF_MEM_LEVEL, strategy) != Z_OK )
{ {
return -1; return -1;
@ -108,7 +108,7 @@ int cmCPackTGZ_Data_Open(void *client_data, const char* pathname,
return -1; return -1;
} }
mydata->m_CRC = crc32(0L, Z_NULL, 0); mydata->CRC = crc32(0L, Z_NULL, 0);
return 0; return 0;
} }
@ -118,27 +118,27 @@ ssize_t cmCPackTGZ_Data_Write(void *client_data, void *buff, size_t n)
{ {
cmCPackTGZ_Data *mydata = (cmCPackTGZ_Data*)client_data; cmCPackTGZ_Data *mydata = (cmCPackTGZ_Data*)client_data;
mydata->m_ZLibStream.avail_in = n; mydata->ZLibStream.avail_in = n;
mydata->m_ZLibStream.next_in = reinterpret_cast<Bytef*>(buff); mydata->ZLibStream.next_in = reinterpret_cast<Bytef*>(buff);
do { do {
mydata->m_ZLibStream.avail_out = cmCPackTGZ_Data_BlockSize; mydata->ZLibStream.avail_out = cmCPackTGZ_Data_BlockSize;
mydata->m_ZLibStream.next_out mydata->ZLibStream.next_out
= reinterpret_cast<Bytef*>(mydata->m_CompressedBuffer); = reinterpret_cast<Bytef*>(mydata->CompressedBuffer);
// no bad return value // no bad return value
int ret = deflate(&mydata->m_ZLibStream, (n?Z_NO_FLUSH:Z_FINISH)); int ret = deflate(&mydata->ZLibStream, (n?Z_NO_FLUSH:Z_FINISH));
if(ret == Z_STREAM_ERROR) if(ret == Z_STREAM_ERROR)
{ {
return 0; return 0;
} }
size_t compressedSize size_t compressedSize
= cmCPackTGZ_Data_BlockSize - mydata->m_ZLibStream.avail_out; = cmCPackTGZ_Data_BlockSize - mydata->ZLibStream.avail_out;
mydata->OutputStream->write( mydata->OutputStream->write(
reinterpret_cast<const char*>(mydata->m_CompressedBuffer), reinterpret_cast<const char*>(mydata->CompressedBuffer),
compressedSize); compressedSize);
} while ( mydata->m_ZLibStream.avail_out == 0 ); } while ( mydata->ZLibStream.avail_out == 0 );
if ( !*mydata->OutputStream ) if ( !*mydata->OutputStream )
{ {
@ -146,7 +146,7 @@ ssize_t cmCPackTGZ_Data_Write(void *client_data, void *buff, size_t n)
} }
if ( n ) if ( n )
{ {
mydata->m_CRC = crc32(mydata->m_CRC, reinterpret_cast<Bytef *>(buff), n); mydata->CRC = crc32(mydata->CRC, reinterpret_cast<Bytef *>(buff), n);
} }
return n; return n;
} }
@ -160,19 +160,19 @@ int cmCPackTGZ_Data_Close(void *client_data)
char buffer[8]; char buffer[8];
int n; int n;
uLong x = mydata->m_CRC; uLong x = mydata->CRC;
for (n = 0; n < 4; n++) { for (n = 0; n < 4; n++) {
buffer[n] = (int)(x & 0xff); buffer[n] = (int)(x & 0xff);
x >>= 8; x >>= 8;
} }
x = mydata->m_ZLibStream.total_in; x = mydata->ZLibStream.total_in;
for (n = 0; n < 4; n++) { for (n = 0; n < 4; n++) {
buffer[n+4] = (int)(x & 0xff); buffer[n+4] = (int)(x & 0xff);
x >>= 8; x >>= 8;
} }
mydata->OutputStream->write(buffer, 8); mydata->OutputStream->write(buffer, 8);
(void)deflateEnd(&mydata->m_ZLibStream); (void)deflateEnd(&mydata->ZLibStream);
delete mydata->OutputStream; delete mydata->OutputStream;
mydata->OutputStream = 0; mydata->OutputStream = 0;
return (0); return (0);
@ -204,7 +204,7 @@ int cmCPackTGZGenerator::CompressFiles(const char* outFileName,
if (tar_open(&t, realName, if (tar_open(&t, realName,
&gztype, &gztype,
flags, 0644, flags, 0644,
(m_GeneratorVerbose?TAR_VERBOSE:0) (this->GeneratorVerbose?TAR_VERBOSE:0)
| 0) == -1) | 0) == -1)
{ {
cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem with tar_open(): " cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem with tar_open(): "

View File

@ -105,8 +105,8 @@ int cpackUnknownArgument(const char*, void*)
struct cpackDefinitions struct cpackDefinitions
{ {
typedef std::map<cmStdString, cmStdString> MapType; typedef std::map<cmStdString, cmStdString> MapType;
MapType m_Map; MapType Map;
cmCPackLog *m_Log; cmCPackLog *Log;
}; };
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
@ -119,14 +119,14 @@ int cpackDefinitionArgument(const char* argument, const char* cValue,
size_t pos = value.find_first_of("="); size_t pos = value.find_first_of("=");
if ( pos == std::string::npos ) if ( pos == std::string::npos )
{ {
cmCPack_Log(def->m_Log, cmCPackLog::LOG_ERROR, cmCPack_Log(def->Log, cmCPackLog::LOG_ERROR,
"Please specify CPack definitions as: KEY=VALUE" << std::endl); "Please specify CPack definitions as: KEY=VALUE" << std::endl);
return 0; return 0;
} }
std::string key = value.substr(0, pos); std::string key = value.substr(0, pos);
value = value.c_str() + pos + 1; value = value.c_str() + pos + 1;
def->m_Map[key] = value; def->Map[key] = value;
cmCPack_Log(def->m_Log, cmCPackLog::LOG_DEBUG, "Set CPack variable: " cmCPack_Log(def->Log, cmCPackLog::LOG_DEBUG, "Set CPack variable: "
<< key.c_str() << " to \"" << value.c_str() << "\"" << std::endl); << key.c_str() << " to \"" << value.c_str() << "\"" << std::endl);
return 1; return 1;
} }
@ -168,7 +168,7 @@ int main (int argc, char *argv[])
std::string cpackConfigFile; std::string cpackConfigFile;
cpackDefinitions definitions; cpackDefinitions definitions;
definitions.m_Log = &log; definitions.Log = &log;
cpackConfigFile = ""; cpackConfigFile = "";
@ -296,8 +296,8 @@ int main (int argc, char *argv[])
mf->AddDefinition("CPACK_BUILD_CONFIG", cpackBuildConfig.c_str()); mf->AddDefinition("CPACK_BUILD_CONFIG", cpackBuildConfig.c_str());
} }
cpackDefinitions::MapType::iterator cdit; cpackDefinitions::MapType::iterator cdit;
for ( cdit = definitions.m_Map.begin(); for ( cdit = definitions.Map.begin();
cdit != definitions.m_Map.end(); cdit != definitions.Map.end();
++cdit ) ++cdit )
{ {
mf->AddDefinition(cdit->first.c_str(), cdit->second.c_str()); mf->AddDefinition(cdit->first.c_str(), cdit->second.c_str());

View File

@ -19,7 +19,8 @@
#include "cmTarget.h" #include "cmTarget.h"
// cmAddCustomCommandCommand // cmAddCustomCommandCommand
bool cmAddCustomCommandCommand::InitialPass(std::vector<std::string> const& args) bool cmAddCustomCommandCommand::InitialPass(
std::vector<std::string> const& args)
{ {
/* Let's complain at the end of this function about the lack of a particular /* Let's complain at the end of this function about the lack of a particular
arg. For the moment, let's say that COMMAND, and either TARGET or SOURCE arg. For the moment, let's say that COMMAND, and either TARGET or SOURCE
@ -198,7 +199,8 @@ bool cmAddCustomCommandCommand::InitialPass(std::vector<std::string> const& args
if(source.empty() && !target.empty() && !output.empty()) if(source.empty() && !target.empty() && !output.empty())
{ {
this->SetError("Wrong syntax. A TARGET and OUTPUT can not both be specified."); this->SetError(
"Wrong syntax. A TARGET and OUTPUT can not both be specified.");
return false; return false;
} }

View File

@ -17,7 +17,8 @@
#include "cmAddCustomTargetCommand.h" #include "cmAddCustomTargetCommand.h"
// cmAddCustomTargetCommand // cmAddCustomTargetCommand
bool cmAddCustomTargetCommand::InitialPass(std::vector<std::string> const& args) bool cmAddCustomTargetCommand::InitialPass(
std::vector<std::string> const& args)
{ {
if(args.size() < 1 ) if(args.size() < 1 )
{ {

View File

@ -17,7 +17,8 @@
#include "cmAddDefinitionsCommand.h" #include "cmAddDefinitionsCommand.h"
// cmAddDefinitionsCommand // cmAddDefinitionsCommand
bool cmAddDefinitionsCommand::InitialPass(std::vector<std::string> const& args) bool cmAddDefinitionsCommand::InitialPass(
std::vector<std::string> const& args)
{ {
// it is OK to have no arguments // it is OK to have no arguments
if(args.size() < 1 ) if(args.size() < 1 )

View File

@ -22,8 +22,8 @@
/** \class cmAddDefinitionsCommand /** \class cmAddDefinitionsCommand
* \brief Specify a list of compiler defines * \brief Specify a list of compiler defines
* *
* cmAddDefinitionsCommand specifies a list of compiler defines. These defines will * cmAddDefinitionsCommand specifies a list of compiler defines. These defines
* be added to the compile command. * will be added to the compile command.
*/ */
class cmAddDefinitionsCommand : public cmCommand class cmAddDefinitionsCommand : public cmCommand
{ {

View File

@ -17,7 +17,8 @@
#include "cmAddDependenciesCommand.h" #include "cmAddDependenciesCommand.h"
// cmDependenciesCommand // cmDependenciesCommand
bool cmAddDependenciesCommand::InitialPass(std::vector<std::string> const& args) bool cmAddDependenciesCommand::InitialPass(
std::vector<std::string> const& args)
{ {
if(args.size() < 2 ) if(args.size() < 2 )
{ {

View File

@ -52,7 +52,8 @@ public:
*/ */
virtual const char* GetTerseDocumentation() virtual const char* GetTerseDocumentation()
{ {
return "Add an executable to the project using the specified source files."; return
"Add an executable to the project using the specified source files.";
} }
/** /**
@ -68,15 +69,15 @@ public:
"specified.\n" "specified.\n"
"After specifying the executable name, WIN32 and/or MACOSX_BUNDLE can " "After specifying the executable name, WIN32 and/or MACOSX_BUNDLE can "
"be specified. WIN32 indicates that the executable (when compiled on " "be specified. WIN32 indicates that the executable (when compiled on "
"windows) is a windows app (using WinMain) not a console app (using main). " "windows) is a windows app (using WinMain) not a console app "
"The variable CMAKE_MFC_FLAG be used if the windows app uses MFC. " "(using main). The variable CMAKE_MFC_FLAG be used if the windows app "
"This variable can be set to the following values:\n" "uses MFC. This variable can be set to the following values:\n"
" 0: Use Standard Windows Libraries\n" " 0: Use Standard Windows Libraries\n"
" 1: Use MFC in a Static Library \n" " 1: Use MFC in a Static Library \n"
" 2: Use MFC in a Shared DLL \n" " 2: Use MFC in a Shared DLL \n"
"MACOSX_BUNDLE indicates that when build on Mac OSX, executable should " "MACOSX_BUNDLE indicates that when build on Mac OSX, executable should "
"be in the bundle form. The MACOSX_BUNDLE also allows several variables " "be in the bundle form. The MACOSX_BUNDLE also allows several "
"to be specified:\n" "variables to be specified:\n"
" MACOSX_BUNDLE_INFO_STRING\n" " MACOSX_BUNDLE_INFO_STRING\n"
" MACOSX_BUNDLE_ICON_FILE\n" " MACOSX_BUNDLE_ICON_FILE\n"
" MACOSX_BUNDLE_GUI_IDENTIFIER\n" " MACOSX_BUNDLE_GUI_IDENTIFIER\n"

View File

@ -32,7 +32,8 @@ bool cmBuildCommand::InitialPass(std::vector<std::string> const& args)
= m_Makefile->GetDefinition(define); = m_Makefile->GetDefinition(define);
std::string makeprogram = args[1]; std::string makeprogram = args[1];
std::string makecommand std::string makecommand
= m_Makefile->GetLocalGenerator()->GetGlobalGenerator()->GenerateBuildCommand( = m_Makefile->GetLocalGenerator()
->GetGlobalGenerator()->GenerateBuildCommand(
makeprogram.c_str(), m_Makefile->GetProjectName(), 0, makeprogram.c_str(), m_Makefile->GetProjectName(), 0,
0, "Release", true); 0, "Release", true);

View File

@ -56,7 +56,8 @@ public:
*/ */
virtual const char* GetTerseDocumentation() virtual const char* GetTerseDocumentation()
{ {
return "Deprecated. Use ${CMAKE_SYSTEM} and ${CMAKE_CXX_COMPILER} instead."; return
"Deprecated. Use ${CMAKE_SYSTEM} and ${CMAKE_CXX_COMPILER} instead.";
} }
/** /**

View File

@ -67,7 +67,8 @@ bool cmCMakeMinimumRequired::InitialPass(std::vector<std::string> const& args)
} }
// Save the required version string. // Save the required version string.
m_Makefile->AddDefinition("CMAKE_MINIMUM_REQUIRED_VERSION", version_string.c_str()); m_Makefile->AddDefinition("CMAKE_MINIMUM_REQUIRED_VERSION",
version_string.c_str());
// Get the current version number. // Get the current version number.
int current_major = m_Makefile->GetMajorVersion(); int current_major = m_Makefile->GetMajorVersion();
@ -102,9 +103,11 @@ bool cmCMakeMinimumRequired::InitialPass(std::vector<std::string> const& args)
{ {
e << "WARNING: "; e << "WARNING: ";
} }
e << "This project requires version " << version_string.c_str() << " of CMake. " e << "This project requires version " << version_string.c_str()
<< " of CMake. "
<< "You are running version " << "You are running version "
<< current_major << "." << current_minor << "." << current_patch << ".\n"; << current_major << "." << current_minor << "." << current_patch
<< ".\n";
if(fatal_error) if(fatal_error)
{ {
cmSystemTools::Error(e.str().c_str()); cmSystemTools::Error(e.str().c_str());

View File

@ -74,9 +74,8 @@ void CCONV cmAddDefinition(void *arg, const char* name, const char* value)
} }
/* Add a definition to this makefile and the global cmake cache. */ /* Add a definition to this makefile and the global cmake cache. */
void CCONV cmAddCacheDefinition(void *arg, const char* name, const char* value, void CCONV cmAddCacheDefinition(void *arg, const char* name,
const char* doc, const char* value, const char* doc, int type)
int type)
{ {
cmMakefile *mf = static_cast<cmMakefile *>(arg); cmMakefile *mf = static_cast<cmMakefile *>(arg);
@ -170,7 +169,8 @@ void CCONV cmAddDefineFlag(void *arg, const char* definition)
mf->AddDefineFlag(definition); mf->AddDefineFlag(definition);
} }
void CCONV cmAddLinkDirectoryForTarget(void *arg, const char *tgt, const char* d) void CCONV cmAddLinkDirectoryForTarget(void *arg, const char *tgt,
const char* d)
{ {
cmMakefile *mf = static_cast<cmMakefile *>(arg); cmMakefile *mf = static_cast<cmMakefile *>(arg);
mf->AddLinkDirectoryForTarget(tgt,d); mf->AddLinkDirectoryForTarget(tgt,d);
@ -368,8 +368,8 @@ void CCONV cmAddCustomCommandToTarget(void *arg, const char* target,
cctype, no_comment, no_working_dir); cctype, no_comment, no_working_dir);
} }
void CCONV cmAddLinkLibraryForTarget(void *arg, const char *tgt, const char*value, void CCONV cmAddLinkLibraryForTarget(void *arg, const char *tgt,
int libtype) const char*value, int libtype)
{ {
cmMakefile *mf = static_cast<cmMakefile *>(arg); cmMakefile *mf = static_cast<cmMakefile *>(arg);
@ -540,7 +540,8 @@ int CCONV cmSourceFileGetPropertyAsBool(void *arg,const char *prop)
return (sf->GetPropertyAsBool(prop) ? 1: 0); return (sf->GetPropertyAsBool(prop) ? 1: 0);
} }
void CCONV cmSourceFileSetProperty(void *arg,const char *prop, const char *val) void CCONV cmSourceFileSetProperty(void *arg,const char *prop,
const char *val)
{ {
cmSourceFile *sf = static_cast<cmSourceFile *>(arg); cmSourceFile *sf = static_cast<cmSourceFile *>(arg);
sf->SetProperty(prop,val); sf->SetProperty(prop,val);

View File

@ -78,7 +78,8 @@ typedef struct
int numOutputs, const char **outputs, int numOutputs, const char **outputs,
const char *target); const char *target);
void (CCONV *AddDefineFlag) (void *mf, const char* definition); void (CCONV *AddDefineFlag) (void *mf, const char* definition);
void (CCONV *AddDefinition) (void *mf, const char* name, const char* value); void (CCONV *AddDefinition) (void *mf, const char* name,
const char* value);
void (CCONV *AddExecutable) (void *mf, const char *exename, void (CCONV *AddExecutable) (void *mf, const char *exename,
int numSrcs, const char **srcs, int win32); int numSrcs, const char **srcs, int win32);
void (CCONV *AddLibrary) (void *mf, const char *libname, void (CCONV *AddLibrary) (void *mf, const char *libname,
@ -94,7 +95,8 @@ typedef struct
int (CCONV *CommandExists) (void *mf, const char* name); int (CCONV *CommandExists) (void *mf, const char* name);
int (CCONV *ExecuteCommand) (void *mf, const char *name, int (CCONV *ExecuteCommand) (void *mf, const char *name,
int numArgs, const char **args); int numArgs, const char **args);
void (CCONV *ExpandSourceListArguments) (void *mf,int argc, const char **argv, void (CCONV *ExpandSourceListArguments) (void *mf,int argc,
const char **argv,
int *resArgc, char ***resArgv, int *resArgc, char ***resArgv,
unsigned int startArgumentIndex); unsigned int startArgumentIndex);
char *(CCONV *ExpandVariablesInString) (void *mf, const char *source, char *(CCONV *ExpandVariablesInString) (void *mf, const char *source,
@ -128,12 +130,14 @@ typedef struct
int (CCONV *SourceFileGetPropertyAsBool) (void *sf, const char *prop); int (CCONV *SourceFileGetPropertyAsBool) (void *sf, const char *prop);
const char *(CCONV *SourceFileGetSourceName) (void *sf); const char *(CCONV *SourceFileGetSourceName) (void *sf);
const char *(CCONV *SourceFileGetFullPath) (void *sf); const char *(CCONV *SourceFileGetFullPath) (void *sf);
void (CCONV *SourceFileSetName) (void *sf, const char* name, const char* dir, void (CCONV *SourceFileSetName) (void *sf, const char* name,
const char* dir,
int numSourceExtensions, int numSourceExtensions,
const char **sourceExtensions, const char **sourceExtensions,
int numHeaderExtensions, int numHeaderExtensions,
const char **headerExtensions); const char **headerExtensions);
void (CCONV *SourceFileSetName2) (void *sf, const char* name, const char* dir, void (CCONV *SourceFileSetName2) (void *sf, const char* name,
const char* dir,
const char *ext, int headerFileOnly); const char *ext, int headerFileOnly);
void (CCONV *SourceFileSetProperty) (void *sf, const char *prop, void (CCONV *SourceFileSetProperty) (void *sf, const char *prop,
const char *value); const char *value);

View File

@ -85,9 +85,11 @@ bool cmCacheManager::ParseEntry(const char* entry,
std::string& value) std::string& value)
{ {
// input line is: key:type=value // input line is: key:type=value
static cmsys::RegularExpression reg("^([^:]*)=(.*[^\r\t ]|[\r\t ]*)[\r\t ]*$"); static cmsys::RegularExpression reg(
"^([^:]*)=(.*[^\r\t ]|[\r\t ]*)[\r\t ]*$");
// input line is: "key":type=value // input line is: "key":type=value
static cmsys::RegularExpression regQuoted("^\"([^\"]*)\"=(.*[^\r\t ]|[\r\t ]*)[\r\t ]*$"); static cmsys::RegularExpression regQuoted(
"^\"([^\"]*)\"=(.*[^\r\t ]|[\r\t ]*)[\r\t ]*$");
bool flag = false; bool flag = false;
if(regQuoted.find(entry)) if(regQuoted.find(entry))
{ {
@ -122,9 +124,11 @@ bool cmCacheManager::ParseEntry(const char* entry,
CacheEntryType& type) CacheEntryType& type)
{ {
// input line is: key:type=value // input line is: key:type=value
static cmsys::RegularExpression reg("^([^:]*):([^=]*)=(.*[^\r\t ]|[\r\t ]*)[\r\t ]*$"); static cmsys::RegularExpression reg(
"^([^:]*):([^=]*)=(.*[^\r\t ]|[\r\t ]*)[\r\t ]*$");
// input line is: "key":type=value // input line is: "key":type=value
static cmsys::RegularExpression regQuoted("^\"([^\"]*)\":([^=]*)=(.*[^\r\t ]|[\r\t ]*)[\r\t ]*$"); static cmsys::RegularExpression regQuoted(
"^\"([^\"]*)\":([^=]*)=(.*[^\r\t ]|[\r\t ]*)[\r\t ]*$");
bool flag = false; bool flag = false;
if(regQuoted.find(entry)) if(regQuoted.find(entry))
{ {
@ -250,12 +254,14 @@ bool cmCacheManager::LoadCache(const char* path,
} }
if ( e.m_Type == cmCacheManager::INTERNAL && if ( e.m_Type == cmCacheManager::INTERNAL &&
(entryKey.size() > strlen("-ADVANCED")) && (entryKey.size() > strlen("-ADVANCED")) &&
strcmp(entryKey.c_str() + (entryKey.size() - strlen("-ADVANCED")), strcmp(entryKey.c_str() + (entryKey.size() -
"-ADVANCED") == 0 ) strlen("-ADVANCED")), "-ADVANCED") == 0 )
{ {
std::string value = e.m_Value; std::string value = e.m_Value;
std::string akey = entryKey.substr(0, (entryKey.size() - strlen("-ADVANCED"))); std::string akey
cmCacheManager::CacheIterator it = this->GetCacheIterator(akey.c_str()); = entryKey.substr(0, (entryKey.size() - strlen("-ADVANCED")));
cmCacheManager::CacheIterator it
= this->GetCacheIterator(akey.c_str());
if ( it.IsAtEnd() ) if ( it.IsAtEnd() )
{ {
e.m_Type = cmCacheManager::UNINITIALIZED; e.m_Type = cmCacheManager::UNINITIALIZED;
@ -269,12 +275,14 @@ bool cmCacheManager::LoadCache(const char* path,
} }
else if ( e.m_Type == cmCacheManager::INTERNAL && else if ( e.m_Type == cmCacheManager::INTERNAL &&
(entryKey.size() > strlen("-MODIFIED")) && (entryKey.size() > strlen("-MODIFIED")) &&
strcmp(entryKey.c_str() + (entryKey.size() - strlen("-MODIFIED")), strcmp(entryKey.c_str() + (entryKey.size() -
"-MODIFIED") == 0 ) strlen("-MODIFIED")), "-MODIFIED") == 0 )
{ {
std::string value = e.m_Value; std::string value = e.m_Value;
std::string akey = entryKey.substr(0, (entryKey.size() - strlen("-MODIFIED"))); std::string akey
cmCacheManager::CacheIterator it = this->GetCacheIterator(akey.c_str()); = entryKey.substr(0, (entryKey.size() - strlen("-MODIFIED")));
cmCacheManager::CacheIterator it
= this->GetCacheIterator(akey.c_str());
if ( it.IsAtEnd() ) if ( it.IsAtEnd() )
{ {
e.m_Type = cmCacheManager::UNINITIALIZED; e.m_Type = cmCacheManager::UNINITIALIZED;
@ -368,7 +376,8 @@ bool cmCacheManager::SaveCache(const char* path)
"Major version of cmake used to create the " "Major version of cmake used to create the "
"current loaded cache", cmCacheManager::INTERNAL); "current loaded cache", cmCacheManager::INTERNAL);
this->AddCacheEntry("CMAKE_CACHE_RELEASE_VERSION", cmMakefile::GetReleaseVersion(), this->AddCacheEntry("CMAKE_CACHE_RELEASE_VERSION",
cmMakefile::GetReleaseVersion(),
"Major version of cmake used to create the " "Major version of cmake used to create the "
"current loaded cache", cmCacheManager::INTERNAL); "current loaded cache", cmCacheManager::INTERNAL);
@ -387,19 +396,25 @@ bool cmCacheManager::SaveCache(const char* path)
fout << "# This is the CMakeCache file.\n" fout << "# This is the CMakeCache file.\n"
<< "# For build in directory: " << currentcwd << "\n"; << "# For build in directory: " << currentcwd << "\n";
cmCacheManager::CacheEntry* cmakeCacheEntry = this->GetCacheEntry("CMAKE_COMMAND"); cmCacheManager::CacheEntry* cmakeCacheEntry
= this->GetCacheEntry("CMAKE_COMMAND");
if ( cmakeCacheEntry ) if ( cmakeCacheEntry )
{ {
fout << "# It was generated by CMake: " << cmakeCacheEntry->m_Value << std::endl; fout << "# It was generated by CMake: " << cmakeCacheEntry->m_Value
<< std::endl;
} }
fout << "# You can edit this file to change values found and used by cmake.\n" fout << "# You can edit this file to change values found and used by cmake."
<< "# If you do not want to change any of the values, simply exit the editor.\n" << std::endl
<< "# If you do want to change a value, simply edit, save, and exit the editor.\n" << "# If you do not want to change any of the values, simply exit the "
"editor." << std::endl
<< "# If you do want to change a value, simply edit, save, and exit "
"the editor." << std::endl
<< "# The syntax for the file is as follows:\n" << "# The syntax for the file is as follows:\n"
<< "# KEY:TYPE=VALUE\n" << "# KEY:TYPE=VALUE\n"
<< "# KEY is the name of a variable in the cache.\n" << "# KEY is the name of a variable in the cache.\n"
<< "# TYPE is a hint to GUI's for the type of VALUE, DO NOT EDIT TYPE!.\n" << "# TYPE is a hint to GUI's for the type of VALUE, DO NOT EDIT "
"TYPE!." << std::endl
<< "# VALUE is the current value for the KEY.\n\n"; << "# VALUE is the current value for the KEY.\n\n";
fout << "########################\n"; fout << "########################\n";
@ -595,7 +610,8 @@ bool cmCacheManager::SaveCache(const char* path)
checkCacheFile.c_str()); checkCacheFile.c_str());
return false; return false;
} }
checkCache << "# This file is generated by cmake for dependency checking of the CMakeCache.txt file\n"; checkCache << "# This file is generated by cmake for dependency checking "
"of the CMakeCache.txt file\n";
return true; return true;
} }
@ -611,7 +627,9 @@ bool cmCacheManager::DeleteCache(const char* path)
cmsys::Directory dir; cmsys::Directory dir;
cmakeFiles += "/CMakeFiles"; cmakeFiles += "/CMakeFiles";
dir.Load(cmakeFiles.c_str()); dir.Load(cmakeFiles.c_str());
for (unsigned long fileNum = 0; fileNum < dir.GetNumberOfFiles(); ++fileNum) for (unsigned long fileNum = 0;
fileNum < dir.GetNumberOfFiles();
++fileNum)
{ {
if(!cmSystemTools:: if(!cmSystemTools::
FileIsDirectory(dir.GetFile(fileNum))) FileIsDirectory(dir.GetFile(fileNum)))
@ -683,7 +701,8 @@ cmCacheManager::CacheEntry *cmCacheManager::GetCacheEntry(const char* key)
return 0; return 0;
} }
cmCacheManager::CacheIterator cmCacheManager::GetCacheIterator(const char *key) cmCacheManager::CacheIterator cmCacheManager::GetCacheIterator(
const char *key)
{ {
return CacheIterator(*this, key); return CacheIterator(*this, key);
} }
@ -709,11 +728,13 @@ void cmCacheManager::PrintCache(std::ostream& out) const
{ {
if((*i).second.m_Type != INTERNAL) if((*i).second.m_Type != INTERNAL)
{ {
out << (*i).first.c_str() << " = " << (*i).second.m_Value.c_str() << std::endl; out << (*i).first.c_str() << " = " << (*i).second.m_Value.c_str()
<< std::endl;
} }
} }
out << "\n\n"; out << "\n\n";
out << "To change values in the CMakeCache, \nedit CMakeCache.txt in your output directory.\n"; out << "To change values in the CMakeCache, "
<< std::endl << "edit CMakeCache.txt in your output directory.\n";
out << "=================================================" << std::endl; out << "=================================================" << std::endl;
} }
@ -745,7 +766,8 @@ void cmCacheManager::AddCacheEntry(const char* key,
} }
else else
{ {
e.m_Properties["HELPSTRING"] = "(This variable does not exists and should not be used)"; e.m_Properties["HELPSTRING"]
= "(This variable does not exists and should not be used)";
} }
m_Cache[key] = e; m_Cache[key] = e;
} }
@ -805,7 +827,8 @@ void cmCacheManager::CacheIterator::SetValue(const char* value)
} }
} }
const char* cmCacheManager::CacheIterator::GetProperty(const char* property) const const char* cmCacheManager::CacheIterator::GetProperty(
const char* property) const
{ {
// make sure it is not at the end // make sure it is not at the end
if (this->IsAtEnd()) if (this->IsAtEnd())
@ -852,7 +875,8 @@ bool cmCacheManager::CacheIterator::GetValueAsBool() const
return cmSystemTools::IsOn(this->GetEntry().m_Value.c_str()); return cmSystemTools::IsOn(this->GetEntry().m_Value.c_str());
} }
bool cmCacheManager::CacheIterator::GetPropertyAsBool(const char* property) const bool cmCacheManager::CacheIterator::GetPropertyAsBool(
const char* property) const
{ {
// make sure it is not at the end // make sure it is not at the end
if (this->IsAtEnd()) if (this->IsAtEnd())

View File

@ -1,7 +1,8 @@
/* A Bison parser, made by GNU Bison 1.875d. */ /* A Bison parser, made by GNU Bison 1.875d. */
/* Skeleton parser for Yacc-like parsing with Bison, /* Skeleton parser for Yacc-like parsing with Bison,
Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004 Free Software
Foundation, Inc.
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -115,7 +116,9 @@ This file must be translated to C and modified to build everywhere.
Run bison like this: Run bison like this:
bison --yacc --name-prefix=cmCommandArgument_yy --defines=cmCommandArgumentParserTokens.h -ocmCommandArgumentParser.cxx cmCommandArgumentParser.y bison --yacc --name-prefix=cmCommandArgument_yy \
--defines=cmCommandArgumentParserTokens.h \
-ocmCommandArgumentParser.cxx cmCommandArgumentParser.y
Modify cmCommandArgumentParser.cxx: Modify cmCommandArgumentParser.cxx:
- remove TABs - remove TABs
@ -153,7 +156,7 @@ static void cmCommandArgumentError(yyscan_t yyscanner, const char* message);
#endif #endif
#ifdef _MSC_VER #ifdef _MSC_VER
# pragma warning (disable: 4102) /* Unused goto label. */ # pragma warning (disable: 4102) /* Unused goto label. */
# pragma warning (disable: 4065) /* Switch statement contains default but no case. */ # pragma warning (disable: 4065) /* Switch contains default but no case. */
#endif #endif
@ -1171,7 +1174,6 @@ yyreduce:
{ {
yyval.str = yyGetParser->ExpandSpecialVariable(yyvsp[-2].str,yyvsp[-1].str); yyval.str = yyGetParser->ExpandSpecialVariable(yyvsp[-2].str,yyvsp[-1].str);
//std::cerr << __LINE__ << " here: [" << $<str>1 << "] [" << $<str>2 << "] [" << $<str>3 << "]" << std::endl;
} }
break; break;
@ -1179,7 +1181,6 @@ yyreduce:
{ {
yyval.str = yyGetParser->ExpandVariable(yyvsp[-1].str); yyval.str = yyGetParser->ExpandVariable(yyvsp[-1].str);
//std::cerr << __LINE__ << " here: [" << $<str>1 << "] [" << $<str>2 << "] [" << $<str>3 << "]" << std::endl;
} }
break; break;

View File

@ -22,7 +22,8 @@
#define YYSTYPE cmCommandArgumentParserHelper::ParserType #define YYSTYPE cmCommandArgumentParserHelper::ParserType
#define YYSTYPE_IS_DECLARED #define YYSTYPE_IS_DECLARED
#define YY_EXTRA_TYPE cmCommandArgumentParserHelper* #define YY_EXTRA_TYPE cmCommandArgumentParserHelper*
#define YY_DECL int cmCommandArgument_yylex(YYSTYPE* yylvalp, yyscan_t yyscanner) #define YY_DECL int cmCommandArgument_yylex(YYSTYPE* yylvalp,\
yyscan_t yyscanner)
/** \class cmCommandArgumentParserHelper /** \class cmCommandArgumentParserHelper
* \brief Helper class for parsing java source files * \brief Helper class for parsing java source files
@ -47,7 +48,8 @@ public:
// For the lexer: // For the lexer:
void AllocateParserType(cmCommandArgumentParserHelper::ParserType* pt, void AllocateParserType(cmCommandArgumentParserHelper::ParserType* pt,
const char* str, int len = 0); const char* str, int len = 0);
bool HandleEscapeSymbol(cmCommandArgumentParserHelper::ParserType* pt, char symbol); bool HandleEscapeSymbol(cmCommandArgumentParserHelper::ParserType* pt,
char symbol);
int LexInput(char* buf, int maxlen); int LexInput(char* buf, int maxlen);
void Error(const char* str); void Error(const char* str);

View File

@ -1,7 +1,8 @@
/* A Bison parser, made by GNU Bison 1.875d. */ /* A Bison parser, made by GNU Bison 1.875d. */
/* Skeleton parser for Yacc-like parsing with Bison, /* Skeleton parser for Yacc-like parsing with Bison,
Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004 Free Software
Foundation, Inc.
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by

View File

@ -73,7 +73,8 @@ bool cmCreateTestSourceList::InitialPass(std::vector<std::string> const& args)
// make sure they specified an extension // make sure they specified an extension
if (cmSystemTools::GetFilenameExtension(*i).size() < 2) if (cmSystemTools::GetFilenameExtension(*i).size() < 2)
{ {
this->SetError("You must specify a file extenion for the test driver file."); this->SetError(
"You must specify a file extenion for the test driver file.");
return false; return false;
} }
std::string driver = m_Makefile->GetCurrentOutputDirectory(); std::string driver = m_Makefile->GetCurrentOutputDirectory();
@ -149,16 +150,21 @@ bool cmCreateTestSourceList::InitialPass(std::vector<std::string> const& args)
} }
if(extraInclude.size()) if(extraInclude.size())
{ {
m_Makefile->AddDefinition("CMAKE_TESTDRIVER_EXTRA_INCLUDES", extraInclude.c_str()); m_Makefile->AddDefinition("CMAKE_TESTDRIVER_EXTRA_INCLUDES",
extraInclude.c_str());
} }
if(function.size()) if(function.size())
{ {
m_Makefile->AddDefinition("CMAKE_TESTDRIVER_ARGVC_FUNCTION", function.c_str()); m_Makefile->AddDefinition("CMAKE_TESTDRIVER_ARGVC_FUNCTION",
function.c_str());
} }
m_Makefile->AddDefinition("CMAKE_FORWARD_DECLARE_TESTS", forwardDeclareCode.c_str()); m_Makefile->AddDefinition("CMAKE_FORWARD_DECLARE_TESTS",
m_Makefile->AddDefinition("CMAKE_FUNCTION_TABLE_ENTIRES", functionMapCode.c_str()); forwardDeclareCode.c_str());
m_Makefile->AddDefinition("CMAKE_FUNCTION_TABLE_ENTIRES",
functionMapCode.c_str());
bool res = true; bool res = true;
if ( !m_Makefile->ConfigureFile(configFile.c_str(), driver.c_str(), false, true, false) ) if ( !m_Makefile->ConfigureFile(configFile.c_str(), driver.c_str(),
false, true, false) )
{ {
res = false; res = false;
} }

View File

@ -37,7 +37,8 @@ cmCustomCommand::cmCustomCommand(const cmCustomCommand& r):
cmCustomCommand::cmCustomCommand(const char* output, cmCustomCommand::cmCustomCommand(const char* output,
const std::vector<std::string>& depends, const std::vector<std::string>& depends,
const cmCustomCommandLines& commandLines, const cmCustomCommandLines& commandLines,
const char* comment, const char* workingDirectory): const char* comment,
const char* workingDirectory):
m_Output(output?output:""), m_Output(output?output:""),
m_Depends(depends), m_Depends(depends),
m_CommandLines(commandLines), m_CommandLines(commandLines),

View File

@ -48,7 +48,8 @@ cmDependsC::~cmDependsC()
{ {
this->WriteCacheFile(); this->WriteCacheFile();
for (std::map<cmStdString, cmIncludeLines*>::iterator it=m_fileCache.begin(); for (std::map<cmStdString, cmIncludeLines*>::iterator it
= m_fileCache.begin();
it!=m_fileCache.end(); ++it) it!=m_fileCache.end(); ++it)
{ {
delete it->second; delete it->second;
@ -154,7 +155,8 @@ bool cmDependsC::WriteDependencies(const char *src, const char *obj,
scanned.insert(fullName); scanned.insert(fullName);
// Check whether this file is already in the cache // Check whether this file is already in the cache
std::map<cmStdString, cmIncludeLines*>::iterator fileIt=m_fileCache.find(fullName); std::map<cmStdString, cmIncludeLines*>::iterator fileIt
= m_fileCache.find(fullName);
if (fileIt!=m_fileCache.end()) if (fileIt!=m_fileCache.end())
{ {
fileIt->second->m_Used=true; fileIt->second->m_Used=true;
@ -238,7 +240,8 @@ void cmDependsC::ReadCacheFile()
haveFileName=true; haveFileName=true;
int newer=0; int newer=0;
cmFileTimeComparison comp; cmFileTimeComparison comp;
bool res=comp.FileTimeCompare(m_cacheFileName.c_str(), line.c_str(), &newer); bool res
= comp.FileTimeCompare(m_cacheFileName.c_str(), line.c_str(), &newer);
if ((res==true) && (newer==1)) //cache is newer than the parsed file if ((res==true) && (newer==1)) //cache is newer than the parsed file
{ {
@ -275,7 +278,8 @@ void cmDependsC::WriteCacheFile() const
return; return;
} }
for (std::map<cmStdString, cmIncludeLines*>::const_iterator fileIt=m_fileCache.begin(); for (std::map<cmStdString, cmIncludeLines*>::const_iterator fileIt
= m_fileCache.begin();
fileIt!=m_fileCache.end(); ++fileIt) fileIt!=m_fileCache.end(); ++fileIt)
{ {
if (fileIt->second->m_Used) if (fileIt->second->m_Used)
@ -302,7 +306,8 @@ void cmDependsC::WriteCacheFile() const
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void cmDependsC::Scan(std::istream& is, const char* directory, const cmStdString& fullName) void cmDependsC::Scan(std::istream& is, const char* directory,
const cmStdString& fullName)
{ {
cmIncludeLines* newCacheEntry=new cmIncludeLines; cmIncludeLines* newCacheEntry=new cmIncludeLines;
newCacheEntry->m_Used=true; newCacheEntry->m_Used=true;

View File

@ -32,7 +32,8 @@ public:
cmDependsC(); cmDependsC();
cmDependsC(std::vector<std::string> const& includes, cmDependsC(std::vector<std::string> const& includes,
const char* scanRegex, const char* complainRegex, const char* scanRegex, const char* complainRegex,
std::set<cmStdString> const& generatedFiles, const cmStdString& cachFileName); std::set<cmStdString> const& generatedFiles,
const cmStdString& cachFileName);
/** Virtual destructor to cleanup subclasses properly. */ /** Virtual destructor to cleanup subclasses properly. */
virtual ~cmDependsC(); virtual ~cmDependsC();
@ -47,7 +48,8 @@ protected:
std::ostream& internalDepends); std::ostream& internalDepends);
// Method to scan a single file. // Method to scan a single file.
void Scan(std::istream& is, const char* directory, const cmStdString& fullName); void Scan(std::istream& is, const char* directory,
const cmStdString& fullName);
// Method to test for the existence of a file. // Method to test for the existence of a file.
bool FileExistsOrIsGenerated(const std::string& fname, bool FileExistsOrIsGenerated(const std::string& fname,

View File

@ -165,7 +165,8 @@ typedef struct yy_buffer_state *YY_BUFFER_STATE;
#define YY_LESS_LINENO(n) #define YY_LESS_LINENO(n)
/* Return all but the first "n" matched characters back to the input stream. */ /* Return all but the first "n" matched characters back to the input stream.
*/
#define yyless(n) \ #define yyless(n) \
do \ do \
{ \ { \
@ -174,7 +175,8 @@ typedef struct yy_buffer_state *YY_BUFFER_STATE;
YY_LESS_LINENO(yyless_macro_arg);\ YY_LESS_LINENO(yyless_macro_arg);\
*yy_cp = yyg->yy_hold_char; \ *yy_cp = yyg->yy_hold_char; \
YY_RESTORE_YY_MORE_OFFSET \ YY_RESTORE_YY_MORE_OFFSET \
yyg->yy_c_buf_p = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ yyg->yy_c_buf_p \
= yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
YY_DO_BEFORE_ACTION; /* set up yytext again */ \ YY_DO_BEFORE_ACTION; /* set up yytext again */ \
} \ } \
while ( 0 ) while ( 0 )
@ -248,8 +250,8 @@ struct yy_buffer_state
* possible backing-up. * possible backing-up.
* *
* When we actually see the EOF, we change the status to "new" * When we actually see the EOF, we change the status to "new"
* (via cmDependsFortran_yyrestart()), so that the user can continue scanning by * (via cmDependsFortran_yyrestart()), so that the user can continue
* just pointing yyin at a new input file. * scanning by just pointing yyin at a new input file.
*/ */
#define YY_BUFFER_EOF_PENDING 2 #define YY_BUFFER_EOF_PENDING 2

View File

@ -185,16 +185,24 @@ struct yy_buffer_state
#endif /* !YY_STRUCT_YY_BUFFER_STATE */ #endif /* !YY_STRUCT_YY_BUFFER_STATE */
void cmDependsFortran_yyrestart (FILE *input_file ,yyscan_t yyscanner ); void cmDependsFortran_yyrestart (FILE *input_file ,yyscan_t yyscanner );
void cmDependsFortran_yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner ); void cmDependsFortran_yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ,
YY_BUFFER_STATE cmDependsFortran_yy_create_buffer (FILE *file,int size ,yyscan_t yyscanner ); yyscan_t yyscanner );
void cmDependsFortran_yy_delete_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner ); YY_BUFFER_STATE cmDependsFortran_yy_create_buffer (FILE *file,int size ,
void cmDependsFortran_yy_flush_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner ); yyscan_t yyscanner );
void cmDependsFortran_yypush_buffer_state (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner ); void cmDependsFortran_yy_delete_buffer (YY_BUFFER_STATE b ,
yyscan_t yyscanner );
void cmDependsFortran_yy_flush_buffer (YY_BUFFER_STATE b ,
yyscan_t yyscanner );
void cmDependsFortran_yypush_buffer_state (YY_BUFFER_STATE new_buffer ,
yyscan_t yyscanner );
void cmDependsFortran_yypop_buffer_state (yyscan_t yyscanner ); void cmDependsFortran_yypop_buffer_state (yyscan_t yyscanner );
YY_BUFFER_STATE cmDependsFortran_yy_scan_buffer (char *base,yy_size_t size ,yyscan_t yyscanner ); YY_BUFFER_STATE cmDependsFortran_yy_scan_buffer (char *base,yy_size_t size ,
YY_BUFFER_STATE cmDependsFortran_yy_scan_string (yyconst char *yy_str ,yyscan_t yyscanner ); yyscan_t yyscanner );
YY_BUFFER_STATE cmDependsFortran_yy_scan_bytes (yyconst char *bytes,int len ,yyscan_t yyscanner ); YY_BUFFER_STATE cmDependsFortran_yy_scan_string (yyconst char *yy_str ,
yyscan_t yyscanner );
YY_BUFFER_STATE cmDependsFortran_yy_scan_bytes (yyconst char *bytes,int len ,
yyscan_t yyscanner );
void *cmDependsFortran_yyalloc (yy_size_t ,yyscan_t yyscanner ); void *cmDependsFortran_yyalloc (yy_size_t ,yyscan_t yyscanner );
void *cmDependsFortran_yyrealloc (void *,yy_size_t ,yyscan_t yyscanner ); void *cmDependsFortran_yyrealloc (void *,yy_size_t ,yyscan_t yyscanner );
@ -231,7 +239,8 @@ void cmDependsFortran_yyset_debug (int debug_flag ,yyscan_t yyscanner );
YY_EXTRA_TYPE cmDependsFortran_yyget_extra (yyscan_t yyscanner ); YY_EXTRA_TYPE cmDependsFortran_yyget_extra (yyscan_t yyscanner );
void cmDependsFortran_yyset_extra (YY_EXTRA_TYPE user_defined ,yyscan_t yyscanner ); void cmDependsFortran_yyset_extra (YY_EXTRA_TYPE user_defined ,
yyscan_t yyscanner );
FILE *cmDependsFortran_yyget_in (yyscan_t yyscanner ); FILE *cmDependsFortran_yyget_in (yyscan_t yyscanner );
@ -294,7 +303,8 @@ extern int cmDependsFortran_yylex (yyscan_t yyscanner);
#define YY_DECL int cmDependsFortran_yylex (yyscan_t yyscanner) #define YY_DECL int cmDependsFortran_yylex (yyscan_t yyscanner)
#endif /* !YY_DECL */ #endif /* !YY_DECL */
/* yy_get_previous_state - get the state just before the EOB char was reached */ /* yy_get_previous_state - get the state just before the EOB char was reached
*/
#undef YY_NEW_FILE #undef YY_NEW_FILE
#undef YY_FLUSH_BUFFER #undef YY_FLUSH_BUFFER

View File

@ -273,7 +273,8 @@ IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile &mf)
f->m_Args = this->m_Args; f->m_Args = this->m_Args;
f->m_Functions = this->m_Functions; f->m_Functions = this->m_Functions;
std::string newName = "_" + this->m_Args[0]; std::string newName = "_" + this->m_Args[0];
mf.GetCMakeInstance()->RenameCommand(this->m_Args[0].c_str(), newName.c_str()); mf.GetCMakeInstance()->RenameCommand(
this->m_Args[0].c_str(), newName.c_str());
mf.AddCommand(f); mf.AddCommand(f);
// remove the function blocker now that the macro is defined // remove the function blocker now that the macro is defined
@ -308,7 +309,9 @@ void cmMacroFunctionBlocker::
ScopeEnded(cmMakefile &mf) ScopeEnded(cmMakefile &mf)
{ {
// macros should end with an EndMacro // macros should end with an EndMacro
cmSystemTools::Error("The end of a CMakeLists file was reached with a MACRO statement that was not closed properly. Within the directory: ", cmSystemTools::Error(
"The end of a CMakeLists file was reached with a MACRO statement that "
"was not closed properly. Within the directory: ",
mf.GetCurrentDirectory(), " with macro ", mf.GetCurrentDirectory(), " with macro ",
m_Args[0].c_str()); m_Args[0].c_str());
} }

View File

@ -93,8 +93,8 @@ public:
"arg1 arg2 arg3 (...). Commands listed after MACRO, " "arg1 arg2 arg3 (...). Commands listed after MACRO, "
"but before the matching ENDMACRO, are not invoked until the macro " "but before the matching ENDMACRO, are not invoked until the macro "
"is invoked. When it is invoked, the commands recorded in the " "is invoked. When it is invoked, the commands recorded in the "
"macro are first modified by replacing formal parameters (${arg1}) with " "macro are first modified by replacing formal parameters (${arg1}) "
"the arguments passed, and then invoked as normal commands. In " "with the arguments passed, and then invoked as normal commands. In "
"addition to referencing the formal parameters you can reference " "addition to referencing the formal parameters you can reference "
"the variable ARGC which will be set to the number of arguments " "the variable ARGC which will be set to the number of arguments "
"passed into the function as well as ARGV0 ARGV1 ARGV2 ... which " "passed into the function as well as ARGV0 ARGV1 ARGV2 ... which "

View File

@ -94,7 +94,8 @@ void cmMakeDepend::GenerateDependInformation(cmDependInformation* info)
const char* path = info->m_FullPath.c_str(); const char* path = info->m_FullPath.c_str();
if(!path) if(!path)
{ {
cmSystemTools::Error("Attempt to find dependencies for file without path!"); cmSystemTools::Error(
"Attempt to find dependencies for file without path!");
return; return;
} }
@ -138,7 +139,8 @@ void cmMakeDepend::GenerateDependInformation(cmDependInformation* info)
{ {
// Try to find the file amongst the sources // Try to find the file amongst the sources
cmSourceFile *srcFile = cmSourceFile *srcFile =
m_Makefile->GetSource(cmSystemTools::GetFilenameWithoutExtension(path).c_str()); m_Makefile->GetSource(
cmSystemTools::GetFilenameWithoutExtension(path).c_str());
if (srcFile) if (srcFile)
{ {
if (srcFile->GetFullPath() == path) if (srcFile->GetFullPath() == path)
@ -189,7 +191,8 @@ void cmMakeDepend::GenerateDependInformation(cmDependInformation* info)
// #include directives // #include directives
void cmMakeDepend::DependWalk(cmDependInformation* info) void cmMakeDepend::DependWalk(cmDependInformation* info)
{ {
cmsys::RegularExpression includeLine("^[ \t]*#[ \t]*include[ \t]*[<\"]([^\">]+)[\">]"); cmsys::RegularExpression includeLine(
"^[ \t]*#[ \t]*include[ \t]*[<\"]([^\">]+)[\">]");
std::ifstream fin(info->m_FullPath.c_str()); std::ifstream fin(info->m_FullPath.c_str());
if(!fin) if(!fin)
{ {

View File

@ -86,12 +86,14 @@ void cmNeedBackwardsCompatibility(const std::string& variable,
{ {
std::string message = "An attempt was made to access a variable: "; std::string message = "An attempt was made to access a variable: ";
message += variable; message += variable;
message += " that has not been defined. Some variables were always defined " message +=
"by CMake in versions prior to 1.6. To fix this you might need to set the " " that has not been defined. Some variables were always defined "
"cache value of CMAKE_BACKWARDS_COMPATIBILITY to 1.4 or less. If you are " "by CMake in versions prior to 1.6. To fix this you might need to set "
"writing a CMakeList file, (or have already set " "the cache value of CMAKE_BACKWARDS_COMPATIBILITY to 1.4 or less. If "
"CMAKE_BACKWARDS_COMPATABILITY to 1.4 or less) then you probably need to " "you are writing a CMakeList file, (or have already set "
"include a CMake module to test for the feature this variable defines."; "CMAKE_BACKWARDS_COMPATABILITY to 1.4 or less) then you probably need "
"to include a CMake module to test for the feature this variable "
"defines.";
cmSystemTools::Error(message.c_str()); cmSystemTools::Error(message.c_str());
} }
#else #else
@ -520,7 +522,8 @@ void cmake::SetDirectoriesFromFile(const char* arg)
{ {
cmCacheManager* cachem = this->GetCacheManager(); cmCacheManager* cachem = this->GetCacheManager();
cmCacheManager::CacheIterator it = cachem->NewIterator(); cmCacheManager::CacheIterator it = cachem->NewIterator();
if(cachem->LoadCache(cachePath.c_str()) && it.Find("CMAKE_HOME_DIRECTORY")) if(cachem->LoadCache(cachePath.c_str()) &&
it.Find("CMAKE_HOME_DIRECTORY"))
{ {
this->SetHomeOutputDirectory(cachePath.c_str()); this->SetHomeOutputDirectory(cachePath.c_str());
this->SetStartOutputDirectory(cachePath.c_str()); this->SetStartOutputDirectory(cachePath.c_str());
@ -565,7 +568,8 @@ void cmake::SetDirectoriesFromFile(const char* arg)
this->SetStartOutputDirectory(cwd.c_str()); this->SetStartOutputDirectory(cwd.c_str());
} }
// at the end of this CMAKE_ROOT and CMAKE_COMMAND should be added to the cache // at the end of this CMAKE_ROOT and CMAKE_COMMAND should be added to the
// cache
int cmake::AddCMakePaths(const char *arg0) int cmake::AddCMakePaths(const char *arg0)
{ {
// Find our own executable. // Find our own executable.
@ -734,9 +738,12 @@ void CMakeCommandUsage(const char* program)
<< "Usage: " << program << " -E [command] [arguments ...]\n" << "Usage: " << program << " -E [command] [arguments ...]\n"
<< "Available commands: \n" << "Available commands: \n"
<< " chdir dir cmd [args]... - run command in a given directory\n" << " chdir dir cmd [args]... - run command in a given directory\n"
<< " copy file destination - copy file to destination (either file or directory)\n" << " copy file destination - copy file to destination (either file or "
<< " copy_if_different in-file out-file - copy file if input has changed\n" "directory)\n"
<< " copy_directory source destination - copy directory 'source' content to directory 'destination'\n" << " copy_if_different in-file out-file - copy file if input has "
"changed\n"
<< " copy_directory source destination - copy directory 'source' "
"content to directory 'destination'\n"
<< " compare_files file1 file2 - check if file1 is same as file2\n" << " compare_files file1 file2 - check if file1 is same as file2\n"
<< " echo [string]... - displays arguments as text\n" << " echo [string]... - displays arguments as text\n"
<< " remove file1 file2 ... - remove the file(s)\n" << " remove file1 file2 ... - remove the file(s)\n"
@ -774,7 +781,8 @@ int cmake::CMakeCommand(std::vector<std::string>& args)
// Copy file if different. // Copy file if different.
if (args[1] == "copy_if_different" && args.size() == 4) if (args[1] == "copy_if_different" && args.size() == 4)
{ {
if(!cmSystemTools::CopyFileIfDifferent(args[2].c_str(), args[3].c_str())) if(!cmSystemTools::CopyFileIfDifferent(args[2].c_str(),
args[3].c_str()))
{ {
std::cerr << "Error copying file (if different) from \"" std::cerr << "Error copying file (if different) from \""
<< args[2].c_str() << "\" to \"" << args[3].c_str() << args[2].c_str() << "\" to \"" << args[3].c_str()
@ -1011,7 +1019,8 @@ int cmake::CMakeCommand(std::vector<std::string>& args)
} }
else if ( flags.find_first_of('c') != flags.npos ) else if ( flags.find_first_of('c') != flags.npos )
{ {
if ( !cmSystemTools::CreateTar(outFile.c_str(), files, gzip, verbose) ) if ( !cmSystemTools::CreateTar(
outFile.c_str(), files, gzip, verbose) )
{ {
cmSystemTools::Error("Problem creating tar: ", outFile.c_str()); cmSystemTools::Error("Problem creating tar: ", outFile.c_str());
return 1; return 1;
@ -1019,7 +1028,8 @@ int cmake::CMakeCommand(std::vector<std::string>& args)
} }
else if ( flags.find_first_of('x') != flags.npos ) else if ( flags.find_first_of('x') != flags.npos )
{ {
if ( !cmSystemTools::ExtractTar(outFile.c_str(), files, gzip, verbose) ) if ( !cmSystemTools::ExtractTar(
outFile.c_str(), files, gzip, verbose) )
{ {
cmSystemTools::Error("Problem extracting tar: ", outFile.c_str()); cmSystemTools::Error("Problem extracting tar: ", outFile.c_str());
return 1; return 1;
@ -1177,7 +1187,8 @@ int cmake::DoPreConfigureChecks()
err << "The source directory \"" << this->GetHomeDirectory() err << "The source directory \"" << this->GetHomeDirectory()
<< "\" does not exist.\n"; << "\" does not exist.\n";
} }
err << "Specify --help for usage, or press the help button on the CMake GUI."; err << "Specify --help for usage, or press the help button on the CMake "
"GUI.";
cmSystemTools::Error(err.str().c_str()); cmSystemTools::Error(err.str().c_str());
return -2; return -2;
} }
@ -1228,7 +1239,8 @@ int cmake::Configure()
{ {
m_CacheManager->AddCacheEntry("CMAKE_HOME_DIRECTORY", m_CacheManager->AddCacheEntry("CMAKE_HOME_DIRECTORY",
this->GetHomeDirectory(), this->GetHomeDirectory(),
"Start directory with the top level CMakeLists.txt file for this project", "Start directory with the top level CMakeLists.txt file for this "
"project",
cmCacheManager::INTERNAL); cmCacheManager::INTERNAL);
} }
@ -1240,7 +1252,8 @@ int cmake::Configure()
cmMakefile::GetMinorVersion()); cmMakefile::GetMinorVersion());
this->m_CacheManager->AddCacheEntry this->m_CacheManager->AddCacheEntry
("CMAKE_BACKWARDS_COMPATIBILITY",ver, ("CMAKE_BACKWARDS_COMPATIBILITY",ver,
"For backwards compatibility, what version of CMake commands and syntax should this version of CMake allow.", "For backwards compatibility, what version of CMake commands and "
"syntax should this version of CMake allow.",
cmCacheManager::STRING); cmCacheManager::STRING);
} }
@ -1257,7 +1270,8 @@ int cmake::Configure()
// set the global flag for unix style paths on cmSystemTools as // set the global flag for unix style paths on cmSystemTools as
// soon as the generator is set. This allows gmake to be used // soon as the generator is set. This allows gmake to be used
// on windows. // on windows.
cmSystemTools::SetForceUnixPaths(m_GlobalGenerator->GetForceUnixPaths()); cmSystemTools::SetForceUnixPaths(
m_GlobalGenerator->GetForceUnixPaths());
} }
else else
{ {
@ -1265,7 +1279,8 @@ int cmake::Configure()
this->SetGlobalGenerator(new cmGlobalBorlandMakefileGenerator); this->SetGlobalGenerator(new cmGlobalBorlandMakefileGenerator);
#elif defined(_WIN32) && !defined(__CYGWIN__) && !defined(CMAKE_BOOT_MINGW) #elif defined(_WIN32) && !defined(__CYGWIN__) && !defined(CMAKE_BOOT_MINGW)
std::string installedCompiler; std::string installedCompiler;
std::string mp = "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\8.0\\Setup;Dbghelp_path]"; std::string mp = "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft"
"\\VisualStudio\\8.0\\Setup;Dbghelp_path]";
cmSystemTools::ExpandRegistryValues(mp); cmSystemTools::ExpandRegistryValues(mp);
if (!(mp == "/registry")) if (!(mp == "/registry"))
{ {
@ -1273,7 +1288,8 @@ int cmake::Configure()
} }
else else
{ {
mp = "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\7.1;InstallDir]"; mp = "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft"
"\\VisualStudio\\7.1;InstallDir]";
cmSystemTools::ExpandRegistryValues(mp); cmSystemTools::ExpandRegistryValues(mp);
if (!(mp == "/registry")) if (!(mp == "/registry"))
{ {
@ -1281,7 +1297,8 @@ int cmake::Configure()
} }
else else
{ {
mp = "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\7.0;InstallDir]"; mp = "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft"
"\\VisualStudio\\7.0;InstallDir]";
cmSystemTools::ExpandRegistryValues(mp); cmSystemTools::ExpandRegistryValues(mp);
if (!(mp == "/registry")) if (!(mp == "/registry"))
{ {
@ -1293,7 +1310,8 @@ int cmake::Configure()
} }
} }
} }
cmGlobalGenerator* gen = this->CreateGlobalGenerator(installedCompiler.c_str()); cmGlobalGenerator* gen
= this->CreateGlobalGenerator(installedCompiler.c_str());
if(!gen) if(!gen)
{ {
gen = new cmGlobalNMakeMakefileGenerator; gen = new cmGlobalNMakeMakefileGenerator;
@ -1328,7 +1346,8 @@ int cmake::Configure()
} }
if(!m_CacheManager->GetCacheValue("CMAKE_GENERATOR")) if(!m_CacheManager->GetCacheValue("CMAKE_GENERATOR"))
{ {
m_CacheManager->AddCacheEntry("CMAKE_GENERATOR", m_GlobalGenerator->GetName(), m_CacheManager->AddCacheEntry("CMAKE_GENERATOR",
m_GlobalGenerator->GetName(),
"Name of generator.", "Name of generator.",
cmCacheManager::INTERNAL); cmCacheManager::INTERNAL);
} }
@ -1384,7 +1403,8 @@ int cmake::Configure()
if(cmSystemTools::GetFatalErrorOccured() && if(cmSystemTools::GetFatalErrorOccured() &&
(!this->m_CacheManager->GetCacheValue("CMAKE_MAKE_PROGRAM") || (!this->m_CacheManager->GetCacheValue("CMAKE_MAKE_PROGRAM") ||
cmSystemTools::IsOff(this->m_CacheManager->GetCacheValue("CMAKE_MAKE_PROGRAM")))) cmSystemTools::IsOff(
this->m_CacheManager->GetCacheValue("CMAKE_MAKE_PROGRAM"))))
{ {
// We must have a bad generator selection. Wipe the cache entry so the // We must have a bad generator selection. Wipe the cache entry so the
// user can select another. // user can select another.
@ -1409,9 +1429,12 @@ int cmake::Configure()
bool cmake::CacheVersionMatches() bool cmake::CacheVersionMatches()
{ {
const char* majv = m_CacheManager->GetCacheValue("CMAKE_CACHE_MAJOR_VERSION"); const char* majv
const char* minv = m_CacheManager->GetCacheValue("CMAKE_CACHE_MINOR_VERSION"); = m_CacheManager->GetCacheValue("CMAKE_CACHE_MAJOR_VERSION");
const char* relv = m_CacheManager->GetCacheValue("CMAKE_CACHE_RELEASE_VERSION"); const char* minv
= m_CacheManager->GetCacheValue("CMAKE_CACHE_MINOR_VERSION");
const char* relv
= m_CacheManager->GetCacheValue("CMAKE_CACHE_RELEASE_VERSION");
bool cacheSameCMake = false; bool cacheSameCMake = false;
if(majv && if(majv &&
atoi(majv) == static_cast<int>(cmMakefile::GetMajorVersion()) atoi(majv) == static_cast<int>(cmMakefile::GetMajorVersion())
@ -1666,14 +1689,19 @@ int cmake::LoadCache()
cacheFile += "/CMakeCache.txt"; cacheFile += "/CMakeCache.txt";
if(cmSystemTools::FileExists(cacheFile.c_str())) if(cmSystemTools::FileExists(cacheFile.c_str()))
{ {
cmSystemTools::Error("There is a CMakeCache.txt file for the current binary tree but cmake does not have permission to read it. Please check the permissions of the directory you are trying to run CMake on."); cmSystemTools::Error(
"There is a CMakeCache.txt file for the current binary tree but "
"cmake does not have permission to read it. Please check the "
"permissions of the directory you are trying to run CMake on.");
return -1; return -1;
} }
} }
if (m_CMakeCommand.size() < 2) if (m_CMakeCommand.size() < 2)
{ {
cmSystemTools::Error("cmake command was not specified prior to loading the cache in cmake.cxx"); cmSystemTools::Error(
"cmake command was not specified prior to loading the cache in "
"cmake.cxx");
return -1; return -1;
} }
@ -1691,7 +1719,8 @@ int cmake::LoadCache()
cmMakefile::GetMinorVersion()); cmMakefile::GetMinorVersion());
this->m_CacheManager->AddCacheEntry this->m_CacheManager->AddCacheEntry
("CMAKE_BACKWARDS_COMPATIBILITY",ver, ("CMAKE_BACKWARDS_COMPATIBILITY",ver,
"For backwards compatibility, what version of CMake commands and syntax should this version of CMake allow.", "For backwards compatibility, what version of CMake commands and "
"syntax should this version of CMake allow.",
cmCacheManager::STRING); cmCacheManager::STRING);
} }
@ -1713,7 +1742,8 @@ void cmake::UpdateProgress(const char *msg, float prog)
} }
} }
void cmake::GetCommandDocumentation(std::vector<cmDocumentationEntry>& v) const void cmake::GetCommandDocumentation(
std::vector<cmDocumentationEntry>& v) const
{ {
for(RegisteredCommandsMap::const_iterator j = m_Commands.begin(); for(RegisteredCommandsMap::const_iterator j = m_Commands.begin();
j != m_Commands.end(); ++j) j != m_Commands.end(); ++j)
@ -1771,7 +1801,8 @@ void cmake::UpdateConversionPathTable()
std::ifstream table( tablepath ); std::ifstream table( tablepath );
if(!table) if(!table)
{ {
cmSystemTools::Error("CMAKE_PATH_TRANSLATION_FILE set to ", tablepath, ". CMake can not open file."); cmSystemTools::Error("CMAKE_PATH_TRANSLATION_FILE set to ", tablepath,
". CMake can not open file.");
cmSystemTools::ReportLastSystemError("CMake can not open file."); cmSystemTools::ReportLastSystemError("CMake can not open file.");
} }
else else
@ -1917,7 +1948,8 @@ const char* cmake::GetCTestCommand()
return m_CTestCommand.c_str(); return m_CTestCommand.c_str();
} }
cmMakefile* mf = this->GetGlobalGenerator()->GetLocalGenerator(0)->GetMakefile(); cmMakefile* mf
= this->GetGlobalGenerator()->GetLocalGenerator(0)->GetMakefile();
#ifdef CMAKE_BUILD_WITH_CMAKE #ifdef CMAKE_BUILD_WITH_CMAKE
m_CTestCommand = mf->GetRequiredDefinition("CMAKE_COMMAND"); m_CTestCommand = mf->GetRequiredDefinition("CMAKE_COMMAND");
m_CTestCommand = removeQuotes(m_CTestCommand); m_CTestCommand = removeQuotes(m_CTestCommand);
@ -1962,7 +1994,8 @@ const char* cmake::GetCPackCommand()
return m_CPackCommand.c_str(); return m_CPackCommand.c_str();
} }
cmMakefile* mf = this->GetGlobalGenerator()->GetLocalGenerator(0)->GetMakefile(); cmMakefile* mf
= this->GetGlobalGenerator()->GetLocalGenerator(0)->GetMakefile();
#ifdef CMAKE_BUILD_WITH_CMAKE #ifdef CMAKE_BUILD_WITH_CMAKE
m_CPackCommand = mf->GetRequiredDefinition("CMAKE_COMMAND"); m_CPackCommand = mf->GetRequiredDefinition("CMAKE_COMMAND");
@ -2031,10 +2064,12 @@ void cmake::GenerateGraphViz(const char* fileName)
{ {
if ( !mf->ReadListFile(0, infile.c_str()) ) if ( !mf->ReadListFile(0, infile.c_str()) )
{ {
cmSystemTools::Error("Problem opening GraphViz options file: ", infile.c_str()); cmSystemTools::Error("Problem opening GraphViz options file: ",
infile.c_str());
return; return;
} }
std::cout << "Read GraphViz options file: " << infile.c_str() << std::endl; std::cout << "Read GraphViz options file: " << infile.c_str()
<< std::endl;
} }
#define __set_if_not_set(var, value, cmakeDefinition) \ #define __set_if_not_set(var, value, cmakeDefinition) \
@ -2045,7 +2080,8 @@ void cmake::GenerateGraphViz(const char* fileName)
} }
__set_if_not_set(graphType, "digraph", "GRAPHVIZ_GRAPH_TYPE"); __set_if_not_set(graphType, "digraph", "GRAPHVIZ_GRAPH_TYPE");
__set_if_not_set(graphName, "GG", "GRAPHVIZ_GRAPH_NAME"); __set_if_not_set(graphName, "GG", "GRAPHVIZ_GRAPH_NAME");
__set_if_not_set(graphHeader, "node [\n fontsize = \"12\"\n];", "GRAPHVIZ_GRAPH_HEADER"); __set_if_not_set(graphHeader, "node [\n fontsize = \"12\"\n];",
"GRAPHVIZ_GRAPH_HEADER");
__set_if_not_set(graphNodePrefix, "node", "GRAPHVIZ_NODE_PREFIX"); __set_if_not_set(graphNodePrefix, "node", "GRAPHVIZ_NODE_PREFIX");
const char* ignoreTargets = mf->GetDefinition("GRAPHVIZ_IGNORE_TARGETS"); const char* ignoreTargets = mf->GetDefinition("GRAPHVIZ_IGNORE_TARGETS");
std::set<cmStdString> ignoreTargetsSet; std::set<cmStdString> ignoreTargetsSet;
@ -2054,7 +2090,9 @@ void cmake::GenerateGraphViz(const char* fileName)
std::vector<std::string> ignoreTargetsVector; std::vector<std::string> ignoreTargetsVector;
cmSystemTools::ExpandListArgument(ignoreTargets,ignoreTargetsVector); cmSystemTools::ExpandListArgument(ignoreTargets,ignoreTargetsVector);
std::vector<std::string>::iterator itvIt; std::vector<std::string>::iterator itvIt;
for ( itvIt = ignoreTargetsVector.begin(); itvIt != ignoreTargetsVector.end(); ++ itvIt ) for ( itvIt = ignoreTargetsVector.begin();
itvIt != ignoreTargetsVector.end();
++ itvIt )
{ {
ignoreTargetsSet.insert(itvIt->c_str()); ignoreTargetsSet.insert(itvIt->c_str());
} }
@ -2093,7 +2131,8 @@ void cmake::GenerateGraphViz(const char* fileName)
sprintf(tgtName, "%s%d", graphNodePrefix, cnt++); sprintf(tgtName, "%s%d", graphNodePrefix, cnt++);
targetNamesNodes[realTargetName] = tgtName; targetNamesNodes[realTargetName] = tgtName;
targetPtrs[realTargetName] = &tit->second; targetPtrs[realTargetName] = &tit->second;
//str << " \"" << tgtName << "\" [ label=\"" << tit->first.c_str() << "\" shape=\"box\"];" << std::endl; //str << " \"" << tgtName << "\" [ label=\"" << tit->first.c_str()
//<< "\" shape=\"box\"];" << std::endl;
} }
} }
// Ok, now find all the stuff we link to that is not in cmake // Ok, now find all the stuff we link to that is not in cmake
@ -2103,7 +2142,8 @@ void cmake::GenerateGraphViz(const char* fileName)
cmTargets::iterator tit; cmTargets::iterator tit;
for ( tit = targets->begin(); tit != targets->end(); ++ tit ) for ( tit = targets->begin(); tit != targets->end(); ++ tit )
{ {
const cmTarget::LinkLibraries* ll = &(tit->second.GetOriginalLinkLibraries()); const cmTarget::LinkLibraries* ll
= &(tit->second.GetOriginalLinkLibraries());
cmTarget::LinkLibraries::const_iterator llit; cmTarget::LinkLibraries::const_iterator llit;
const char* realTargetName = tit->first.c_str(); const char* realTargetName = tit->first.c_str();
if ( ignoreTargetsSet.find(realTargetName) != ignoreTargetsSet.end() ) if ( ignoreTargetsSet.find(realTargetName) != ignoreTargetsSet.end() )
@ -2118,7 +2158,8 @@ void cmake::GenerateGraphViz(const char* fileName)
for ( llit = ll->begin(); llit != ll->end(); ++ llit ) for ( llit = ll->begin(); llit != ll->end(); ++ llit )
{ {
const char* libName = llit->first.c_str(); const char* libName = llit->first.c_str();
std::map<cmStdString, cmStdString>::iterator tarIt = targetNamesNodes.find(libName); std::map<cmStdString, cmStdString>::iterator tarIt
= targetNamesNodes.find(libName);
if ( ignoreTargetsSet.find(libName) != ignoreTargetsSet.end() ) if ( ignoreTargetsSet.find(libName) != ignoreTargetsSet.end() )
{ {
// Skip ignored targets // Skip ignored targets
@ -2129,11 +2170,13 @@ void cmake::GenerateGraphViz(const char* fileName)
sprintf(tgtName, "%s%d", graphNodePrefix, cnt++); sprintf(tgtName, "%s%d", graphNodePrefix, cnt++);
targetDeps[libName] = 2; targetDeps[libName] = 2;
targetNamesNodes[libName] = tgtName; targetNamesNodes[libName] = tgtName;
//str << " \"" << tgtName << "\" [ label=\"" << libName << "\" shape=\"ellipse\"];" << std::endl; //str << " \"" << tgtName << "\" [ label=\"" << libName
//<< "\" shape=\"ellipse\"];" << std::endl;
} }
else else
{ {
std::map<cmStdString, int>::iterator depIt = targetDeps.find(libName); std::map<cmStdString, int>::iterator depIt
= targetDeps.find(libName);
if ( depIt == targetDeps.end() ) if ( depIt == targetDeps.end() )
{ {
targetDeps[libName] = 1; targetDeps[libName] = 1;
@ -2148,22 +2191,27 @@ void cmake::GenerateGraphViz(const char* fileName)
for ( depIt = targetDeps.begin(); depIt != targetDeps.end(); ++ depIt ) for ( depIt = targetDeps.begin(); depIt != targetDeps.end(); ++ depIt )
{ {
const char* newTargetName = depIt->first.c_str(); const char* newTargetName = depIt->first.c_str();
std::map<cmStdString, cmStdString>::iterator tarIt = targetNamesNodes.find(newTargetName); std::map<cmStdString, cmStdString>::iterator tarIt
= targetNamesNodes.find(newTargetName);
if ( tarIt == targetNamesNodes.end() ) if ( tarIt == targetNamesNodes.end() )
{ {
// We should not be here. // We should not be here.
std::cout << __LINE__ << " Cannot find library: " << newTargetName << " even though it was added in the previous pass" << std::endl; std::cout << __LINE__ << " Cannot find library: " << newTargetName
<< " even though it was added in the previous pass" << std::endl;
abort(); abort();
} }
str << " \"" << tarIt->second.c_str() << "\" [ label=\"" << newTargetName << "\" shape=\""; str << " \"" << tarIt->second.c_str() << "\" [ label=\""
<< newTargetName << "\" shape=\"";
if ( depIt->second == 1 ) if ( depIt->second == 1 )
{ {
std::map<cmStdString, cmTarget*>::iterator tarTypeIt= targetPtrs.find(newTargetName); std::map<cmStdString, cmTarget*>::iterator tarTypeIt= targetPtrs.find(
newTargetName);
if ( tarTypeIt == targetPtrs.end() ) if ( tarTypeIt == targetPtrs.end() )
{ {
// We should not be here. // We should not be here.
std::cout << __LINE__ << " Cannot find library: " << newTargetName << " even though it was added in the previous pass" << std::endl; std::cout << __LINE__ << " Cannot find library: " << newTargetName
<< " even though it was added in the previous pass" << std::endl;
abort(); abort();
} }
cmTarget* tg = tarTypeIt->second; cmTarget* tg = tarTypeIt->second;
@ -2199,31 +2247,38 @@ void cmake::GenerateGraphViz(const char* fileName)
cmTargets::iterator tit; cmTargets::iterator tit;
for ( tit = targets->begin(); tit != targets->end(); ++ tit ) for ( tit = targets->begin(); tit != targets->end(); ++ tit )
{ {
std::map<cmStdString, int>::iterator dependIt = targetDeps.find(tit->first.c_str()); std::map<cmStdString, int>::iterator dependIt
= targetDeps.find(tit->first.c_str());
if ( dependIt == targetDeps.end() ) if ( dependIt == targetDeps.end() )
{ {
continue; continue;
} }
std::map<cmStdString, cmStdString>::iterator cmakeTarIt = targetNamesNodes.find(tit->first.c_str()); std::map<cmStdString, cmStdString>::iterator cmakeTarIt
const cmTarget::LinkLibraries* ll = &(tit->second.GetOriginalLinkLibraries()); = targetNamesNodes.find(tit->first.c_str());
const cmTarget::LinkLibraries* ll
= &(tit->second.GetOriginalLinkLibraries());
cmTarget::LinkLibraries::const_iterator llit; cmTarget::LinkLibraries::const_iterator llit;
for ( llit = ll->begin(); llit != ll->end(); ++ llit ) for ( llit = ll->begin(); llit != ll->end(); ++ llit )
{ {
const char* libName = llit->first.c_str(); const char* libName = llit->first.c_str();
std::map<cmStdString, cmStdString>::iterator tarIt = targetNamesNodes.find(libName); std::map<cmStdString, cmStdString>::iterator tarIt
= targetNamesNodes.find(libName);
if ( tarIt == targetNamesNodes.end() ) if ( tarIt == targetNamesNodes.end() )
{ {
// We should not be here. // We should not be here.
std::cout << __LINE__ << " Cannot find library: " << libName << " even though it was added in the previous pass" << std::endl; std::cout << __LINE__ << " Cannot find library: " << libName
<< " even though it was added in the previous pass" << std::endl;
abort(); abort();
} }
str << " \"" << cmakeTarIt->second.c_str() << "\" -> \"" << tarIt->second.c_str() << "\"" << std::endl; str << " \"" << cmakeTarIt->second.c_str() << "\" -> \""
<< tarIt->second.c_str() << "\"" << std::endl;
} }
} }
} }
// TODO: Use dotted or something for external libraries // TODO: Use dotted or something for external libraries
//str << " \"node0\":f4 -> \"node12\"[color=\"#0000ff\" style=dotted]" << std::endl; //str << " \"node0\":f4 -> \"node12\"[color=\"#0000ff\" style=dotted]"
//<< std::endl;
// //
str << "}" << std::endl; str << "}" << std::endl;
} }

View File

@ -24,7 +24,8 @@ cmakewizard::cmakewizard()
} }
void cmakewizard::AskUser(const char* key, cmCacheManager::CacheIterator& iter) void cmakewizard::AskUser(const char* key,
cmCacheManager::CacheIterator& iter)
{ {
printf("Variable Name: %s\n", key); printf("Variable Name: %s\n", key);
const char* helpstring = iter.GetProperty("HELPSTRING"); const char* helpstring = iter.GetProperty("HELPSTRING");
@ -105,7 +106,8 @@ int cmakewizard::RunWizard(std::vector<std::string> const& args)
{ {
asked = false; asked = false;
// run cmake // run cmake
this->ShowMessage("Please wait while cmake processes CMakeLists.txt files....\n"); this->ShowMessage(
"Please wait while cmake processes CMakeLists.txt files....\n");
make.Configure(); make.Configure();
this->ShowMessage("\n"); this->ShowMessage("\n");