diff options
Diffstat (limited to 'Source')
41 files changed, 978 insertions, 844 deletions
diff --git a/Source/CPack/cmCPackGenerators.cxx b/Source/CPack/cmCPackGenerators.cxx index cf83f20..7713a00 100644 --- a/Source/CPack/cmCPackGenerators.cxx +++ b/Source/CPack/cmCPackGenerators.cxx @@ -9,8 +9,8 @@ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ @@ -39,7 +39,7 @@ cmCPackGenerators::cmCPackGenerators() cmCPackGenerators::~cmCPackGenerators() { 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; } @@ -53,8 +53,8 @@ cmCPackGenericGenerator* cmCPackGenerators::NewGenerator(const char* name) { return 0; } - m_Generators.push_back(gen); - gen->SetLogger(m_Logger); + this->Generators.push_back(gen); + gen->SetLogger(this->Logger); return gen; } @@ -67,8 +67,8 @@ cmCPackGenericGenerator* cmCPackGenerators::NewGeneratorInternal( return 0; } cmCPackGenerators::t_GeneratorCreatorsMap::iterator it - = m_GeneratorCreators.find(name); - if ( it == m_GeneratorCreators.end() ) + = this->GeneratorCreators.find(name); + if ( it == this->GeneratorCreators.end() ) { return 0; } @@ -81,9 +81,9 @@ void cmCPackGenerators::RegisterGenerator(const char* name, { if ( !name || !createGenerator ) { - cmCPack_Log(m_Logger, cmCPackLog::LOG_ERROR, "Cannot register generator" - << std::endl); + cmCPack_Log(this->Logger, cmCPackLog::LOG_ERROR, + "Cannot register generator" << std::endl); return; } - m_GeneratorCreators[name] = createGenerator; + this->GeneratorCreators[name] = createGenerator; } diff --git a/Source/CPack/cmCPackGenerators.h b/Source/CPack/cmCPackGenerators.h index efd5a71..d100e9b 100644 --- a/Source/CPack/cmCPackGenerators.h +++ b/Source/CPack/cmCPackGenerators.h @@ -9,8 +9,8 @@ Copyright (c) 2002 Kitware, Inc. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ @@ -44,15 +44,15 @@ public: void RegisterGenerator(const char* name, CreateGeneratorCall* createGenerator); - void SetLogger(cmCPackLog* logger) { m_Logger = logger; } + void SetLogger(cmCPackLog* logger) { this->Logger = logger; } private: cmCPackGenericGenerator* NewGeneratorInternal(const char* name); - std::vector<cmCPackGenericGenerator*> m_Generators; + std::vector<cmCPackGenericGenerator*> Generators; typedef std::map<cmStdString, CreateGeneratorCall*> t_GeneratorCreatorsMap; - t_GeneratorCreatorsMap m_GeneratorCreators; - cmCPackLog* m_Logger; + t_GeneratorCreatorsMap GeneratorCreators; + cmCPackLog* Logger; }; #endif diff --git a/Source/CPack/cmCPackGenericGenerator.cxx b/Source/CPack/cmCPackGenericGenerator.cxx index 209c597..4ceea02 100644 --- a/Source/CPack/cmCPackGenericGenerator.cxx +++ b/Source/CPack/cmCPackGenericGenerator.cxx @@ -9,8 +9,8 @@ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ @@ -31,21 +31,21 @@ //---------------------------------------------------------------------- cmCPackGenericGenerator::cmCPackGenericGenerator() { - m_GeneratorVerbose = false; - m_MakefileMap = 0; - m_Logger = 0; + this->GeneratorVerbose = false; + this->MakefileMap = 0; + this->Logger = 0; } //---------------------------------------------------------------------- cmCPackGenericGenerator::~cmCPackGenericGenerator() { - m_MakefileMap = 0; + this->MakefileMap = 0; } //---------------------------------------------------------------------- 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"); tempDirectory += "/_CPack_Packages/"; tempDirectory += this->GetOption("CPACK_GENERATOR"); @@ -157,7 +157,7 @@ int cmCPackGenericGenerator::InstallProject() std::string output; int retVal = 1; bool resB = cmSystemTools::RunSingleCommand(it->c_str(), &output, - &retVal, 0, m_GeneratorVerbose, 0); + &retVal, 0, this->GeneratorVerbose, 0); if ( !resB || retVal ) { std::string tmpFile = this->GetOption("CPACK_TOPLEVEL_DIRECTORY"); @@ -272,12 +272,12 @@ void cmCPackGenericGenerator::SetOption(const char* op, const char* value) } if ( !value ) { - m_MakefileMap->RemoveDefinition(op); + this->MakefileMap->RemoveDefinition(op); return; } cmCPackLogger(cmCPackLog::LOG_DEBUG, this->GetNameOfClass() << "::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) { - m_MakefileMap = mf; - m_Name = name; + this->MakefileMap = mf; + this->Name = name; return 1; } //---------------------------------------------------------------------- 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; // Find our own executable. std::vector<cmStdString> failures; - m_CPackSelf = arg0; - cmSystemTools::ConvertToUnixSlashes(m_CPackSelf); - failures.push_back(m_CPackSelf); - m_CPackSelf = cmSystemTools::FindProgram(m_CPackSelf.c_str()); - if(!cmSystemTools::FileExists(m_CPackSelf.c_str())) + this->CPackSelf = arg0; + cmSystemTools::ConvertToUnixSlashes(this->CPackSelf); + failures.push_back(this->CPackSelf); + this->CPackSelf = cmSystemTools::FindProgram(this->CPackSelf.c_str()); + if(!cmSystemTools::FileExists(this->CPackSelf.c_str())) { - failures.push_back(m_CPackSelf); - m_CPackSelf = "/usr/local/bin/ctest"; + failures.push_back(this->CPackSelf); + 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; msg << "CTEST can not find the command line program ctest.\n"; msg << " argv[0] = \"" << arg0 << "\"\n"; @@ -388,33 +388,33 @@ int cmCPackGenericGenerator::FindRunningCMake(const char* arg0) } std::string dir; std::string file; - if(cmSystemTools::SplitProgramPath(m_CPackSelf.c_str(), + if(cmSystemTools::SplitProgramPath(this->CPackSelf.c_str(), dir, file, true)) { - m_CMakeSelf = dir += "/cmake"; - m_CMakeSelf += cmSystemTools::GetExecutableExtension(); - if(cmSystemTools::FileExists(m_CMakeSelf.c_str())) + this->CMakeSelf = dir += "/cmake"; + this->CMakeSelf += cmSystemTools::GetExecutableExtension(); + if(cmSystemTools::FileExists(this->CMakeSelf.c_str())) { found = 1; } } if ( !found ) { - failures.push_back(m_CMakeSelf); + failures.push_back(this->CMakeSelf); #ifdef CMAKE_BUILD_DIR std::string intdir = "."; #ifdef CMAKE_INTDIR intdir = CMAKE_INTDIR; #endif - m_CMakeSelf = CMAKE_BUILD_DIR; - m_CMakeSelf += "/bin/"; - m_CMakeSelf += intdir; - m_CMakeSelf += "/cmake"; - m_CMakeSelf += cmSystemTools::GetExecutableExtension(); + this->CMakeSelf = CMAKE_BUILD_DIR; + this->CMakeSelf += "/bin/"; + this->CMakeSelf += intdir; + this->CMakeSelf += "/cmake"; + this->CMakeSelf += cmSystemTools::GetExecutableExtension(); #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; msg << "CTEST can not find the command line program cmake.\n"; msg << " argv[0] = \"" << arg0 << "\"\n"; @@ -439,14 +439,14 @@ int cmCPackGenericGenerator::FindRunningCMake(const char* arg0) if(modules.empty() || !cmSystemTools::FileExists(modules.c_str())) { // next try exe/.. - cMakeRoot = cmSystemTools::GetProgramPath(m_CMakeSelf.c_str()); + cMakeRoot = cmSystemTools::GetProgramPath(this->CMakeSelf.c_str()); std::string::size_type slashPos = cMakeRoot.rfind("/"); - if(slashPos != std::string::npos) + if(slashPos != std::string::npos) { cMakeRoot = cMakeRoot.substr(0, slashPos); } // is there no Modules direcory there? - modules = cMakeRoot + "/Modules/CMake.cmake"; + modules = cMakeRoot + "/Modules/CMake.cmake"; cmCPackLogger(cmCPackLog::LOG_DEBUG, "Looking for CMAKE_ROOT: " << modules.c_str() << std::endl); } @@ -481,8 +481,8 @@ int cmCPackGenericGenerator::FindRunningCMake(const char* arg0) #endif if (!cmSystemTools::FileExists(modules.c_str())) { - // try - cMakeRoot = cmSystemTools::GetProgramPath(m_CMakeSelf.c_str()); + // try + cMakeRoot = cmSystemTools::GetProgramPath(this->CMakeSelf.c_str()); cMakeRoot += CMAKE_DATA_DIR; modules = cMakeRoot + "/Modules/CMake.cmake"; cmCPackLogger(cmCPackLog::LOG_DEBUG, "Looking for CMAKE_ROOT: " @@ -491,9 +491,9 @@ int cmCPackGenericGenerator::FindRunningCMake(const char* arg0) if(!cmSystemTools::FileExists(modules.c_str())) { // next try exe - cMakeRoot = cmSystemTools::GetProgramPath(m_CMakeSelf.c_str()); + cMakeRoot = cmSystemTools::GetProgramPath(this->CMakeSelf.c_str()); // is there no Modules direcory there? - modules = cMakeRoot + "/Modules/CMake.cmake"; + modules = cMakeRoot + "/Modules/CMake.cmake"; cmCPackLogger(cmCPackLog::LOG_DEBUG, "Looking for CMAKE_ROOT: " << modules.c_str() << std::endl); } @@ -506,10 +506,10 @@ int cmCPackGenericGenerator::FindRunningCMake(const char* arg0) cMakeRoot.c_str()); return 0; } - m_CMakeRoot = cMakeRoot; + this->CMakeRoot = cMakeRoot; cmCPackLogger(cmCPackLog::LOG_DEBUG, "Looking for CMAKE_ROOT: " - << m_CMakeRoot.c_str() << std::endl); - this->SetOption("CMAKE_ROOT", m_CMakeRoot.c_str()); + << this->CMakeRoot.c_str() << std::endl); + this->SetOption("CMAKE_ROOT", this->CMakeRoot.c_str()); return 1; } @@ -526,34 +526,34 @@ int cmCPackGenericGenerator::CompressFiles(const char* outFileName, //---------------------------------------------------------------------- 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__) const char* prgfiles = cmsys::SystemTools::GetEnv("ProgramFiles"); const char* sysDrive = cmsys::SystemTools::GetEnv("SystemDrive"); if ( prgfiles ) { - m_InstallPath = prgfiles; + this->InstallPath = prgfiles; } else if ( sysDrive ) { - m_InstallPath = sysDrive; - m_InstallPath += "/Program Files"; + this->InstallPath = sysDrive; + this->InstallPath += "/Program Files"; } - else + else { - m_InstallPath = "c:/Program Files"; + this->InstallPath = "c:/Program Files"; } - m_InstallPath += "/"; - m_InstallPath += this->GetOption("CPACK_PACKAGE_NAME"); - m_InstallPath += "-"; - m_InstallPath += this->GetOption("CPACK_PACKAGE_VERSION"); + this->InstallPath += "/"; + this->InstallPath += this->GetOption("CPACK_PACKAGE_NAME"); + this->InstallPath += "-"; + this->InstallPath += this->GetOption("CPACK_PACKAGE_VERSION"); #else - m_InstallPath = "/usr/local/"; + this->InstallPath = "/usr/local/"; #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: " << name << std::endl); - std::string ffile = m_MakefileMap->GetModulesFile(name); + std::string ffile = this->MakefileMap->GetModulesFile(name); cmCPackLogger(cmCPackLog::LOG_DEBUG, "Found template: " << ffile.c_str() << std::endl); return ffile; @@ -571,6 +571,6 @@ std::string cmCPackGenericGenerator::FindTemplate(const char* name) bool cmCPackGenericGenerator::ConfigureFile(const char* inName, const char* outName) { - return m_MakefileMap->ConfigureFile(inName, outName, + return this->MakefileMap->ConfigureFile(inName, outName, false, true, false) == 1; } diff --git a/Source/CPack/cmCPackGenericGenerator.h b/Source/CPack/cmCPackGenericGenerator.h index 6a4e015..82214a5 100644 --- a/Source/CPack/cmCPackGenericGenerator.h +++ b/Source/CPack/cmCPackGenericGenerator.h @@ -29,7 +29,7 @@ do { \ cmOStringStream cmCPackLog_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 ) #ifdef cerr @@ -56,7 +56,7 @@ public: /** * 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. @@ -83,7 +83,7 @@ public: int FindRunningCMake(const char* arg0); //! Set the logger - void SetLogger(cmCPackLog* log) { m_Logger = log; } + void SetLogger(cmCPackLog* log) { this->Logger = log; } protected: int PrepareNames(); @@ -99,19 +99,19 @@ protected: virtual std::string FindTemplate(const char* name); virtual bool ConfigureFile(const char* inName, const char* outName); - bool m_GeneratorVerbose; - std::string m_Name; + bool GeneratorVerbose; + std::string Name; - std::string m_InstallPath; + std::string InstallPath; - std::string m_CPackSelf; - std::string m_CMakeSelf; - std::string m_CMakeRoot; + std::string CPackSelf; + std::string CMakeSelf; + std::string CMakeRoot; - cmCPackLog* m_Logger; + cmCPackLog* Logger; private: - cmMakefile* m_MakefileMap; + cmMakefile* MakefileMap; }; #endif diff --git a/Source/CPack/cmCPackLog.cxx b/Source/CPack/cmCPackLog.cxx index 180d7df..7b58039 100644 --- a/Source/CPack/cmCPackLog.cxx +++ b/Source/CPack/cmCPackLog.cxx @@ -9,8 +9,8 @@ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ @@ -22,19 +22,19 @@ //---------------------------------------------------------------------- cmCPackLog::cmCPackLog() { - m_Verbose = false; - m_Debug = false; - m_Quiet = false; - m_NewLine = true; + this->Verbose = false; + this->Debug = false; + this->Quiet = false; + this->NewLine = true; - m_LastTag = cmCPackLog::NOTAG; + this->LastTag = cmCPackLog::NOTAG; #undef cerr #undef cout - m_DefaultOutput = &std::cout; - m_DefaultError = &std::cerr; - - m_LogOutput = 0; - m_LogOutputCleanup = false; + this->DefaultOutput = &std::cout; + this->DefaultError = &std::cerr; + + this->LogOutput = 0; + this->LogOutputCleanup = false; } //---------------------------------------------------------------------- @@ -46,12 +46,12 @@ cmCPackLog::~cmCPackLog() //---------------------------------------------------------------------- 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; - m_LogOutput = os; + this->LogOutputCleanup = false; + this->LogOutput = os; } //---------------------------------------------------------------------- @@ -72,7 +72,7 @@ bool cmCPackLog::SetLogOutputFile(const char* fname) { return false; } - m_LogOutputCleanup = true; + this->LogOutputCleanup = true; return true; } @@ -84,7 +84,7 @@ void cmCPackLog::Log(int tag, const char* file, int line, bool display = false; // Display file and line number if debug - bool useFileAndLine = m_Debug; + bool useFileAndLine = this->Debug; bool output = 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. std::string tagString; bool needTagString = false; - if ( m_LogOutput && m_LastTag != tag ) + if ( this->LogOutput && this->LastTag != tag ) { needTagString = true; } @@ -130,7 +130,7 @@ void cmCPackLog::Log(int tag, const char* file, int line, tagString = "ERROR"; } } - if ( tag & LOG_DEBUG && m_Debug ) + if ( tag & LOG_DEBUG && this->Debug ) { debug = true; display = true; @@ -141,7 +141,7 @@ void cmCPackLog::Log(int tag, const char* file, int line, } useFileAndLine = true; } - if ( tag & LOG_VERBOSE && m_Verbose ) + if ( tag & LOG_VERBOSE && this->Verbose ) { verbose = true; display = true; @@ -151,73 +151,74 @@ void cmCPackLog::Log(int tag, const char* file, int line, tagString = "VERBOSE"; } } - if ( m_Quiet ) + if ( this->Quiet ) { display = false; } - if ( m_LogOutput ) + if ( this->LogOutput ) { 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 ) { 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 ( error || warning ) { - *m_DefaultError << file << ":" << line << " "; + *this->DefaultError << file << ":" << line << " "; } else { - *m_DefaultOutput << file << ":" << line << " "; + *this->DefaultOutput << file << ":" << line << " "; } } } if ( error || warning ) { - m_DefaultError->write(msg, length); - m_DefaultError->flush(); + this->DefaultError->write(msg, length); + this->DefaultError->flush(); } else { - m_DefaultOutput->write(msg, length); - m_DefaultOutput->flush(); + this->DefaultOutput->write(msg, length); + this->DefaultOutput->flush(); } if ( msg[length-1] == '\n' || length > 2 ) { - m_NewLine = true; + this->NewLine = true; } } diff --git a/Source/CPack/cmCPackLog.h b/Source/CPack/cmCPackLog.h index 3970876..ec18ce7 100644 --- a/Source/CPack/cmCPackLog.h +++ b/Source/CPack/cmCPackLog.h @@ -9,8 +9,8 @@ Copyright (c) 2002 Kitware, Inc. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ @@ -78,26 +78,26 @@ public: //! Set Verbose void VerboseOn() { this->SetVerbose(true); } void VerboseOff() { this->SetVerbose(true); } - void SetVerbose(bool verb) { m_Verbose = verb; } - bool GetVerbose() { return m_Verbose; } + void SetVerbose(bool verb) { this->Verbose = verb; } + bool GetVerbose() { return this->Verbose; } //! Set Debug void DebugOn() { this->SetDebug(true); } void DebugOff() { this->SetDebug(true); } - void SetDebug(bool verb) { m_Debug = verb; } - bool GetDebug() { return m_Debug; } + void SetDebug(bool verb) { this->Debug = verb; } + bool GetDebug() { return this->Debug; } //! Set Quiet void QuietOn() { this->SetQuiet(true); } void QuietOff() { this->SetQuiet(true); } - void SetQuiet(bool verb) { m_Quiet = verb; } - bool GetQuiet() { return m_Quiet; } + void SetQuiet(bool verb) { this->Quiet = verb; } + bool GetQuiet() { return this->Quiet; } //! Set the output stream - void SetOutputStream(std::ostream* os) { m_DefaultOutput = os; } + void SetOutputStream(std::ostream* os) { this->DefaultOutput = os; } //! 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 void SetLogOutputStream(std::ostream* os); @@ -108,36 +108,36 @@ public: //! Set the various prefixes for the logging. SetPrefix sets the generic // prefix that overwrittes missing ones. - void SetPrefix(std::string pfx) { m_Prefix = pfx; } - void SetOutputPrefix(std::string pfx) { m_OutputPrefix = pfx; } - void SetVerbosePrefix(std::string pfx) { m_VerbosePrefix = pfx; } - void SetDebugPrefix(std::string pfx) { m_DebugPrefix = pfx; } - void SetWarningPrefix(std::string pfx) { m_WarningPrefix = pfx; } - void SetErrorPrefix(std::string pfx) { m_ErrorPrefix = pfx; } + void SetPrefix(std::string pfx) { this->Prefix = pfx; } + void SetOutputPrefix(std::string pfx) { this->OutputPrefix = pfx; } + void SetVerbosePrefix(std::string pfx) { this->VerbosePrefix = pfx; } + void SetDebugPrefix(std::string pfx) { this->DebugPrefix = pfx; } + void SetWarningPrefix(std::string pfx) { this->WarningPrefix = pfx; } + void SetErrorPrefix(std::string pfx) { this->ErrorPrefix = pfx; } private: - bool m_Verbose; - bool m_Debug; - bool m_Quiet; + bool Verbose; + bool Debug; + bool Quiet; - bool m_NewLine; + bool NewLine; - int m_LastTag; + int LastTag; - std::string m_Prefix; - std::string m_OutputPrefix; - std::string m_VerbosePrefix; - std::string m_DebugPrefix; - std::string m_WarningPrefix; - std::string m_ErrorPrefix; + std::string Prefix; + std::string OutputPrefix; + std::string VerbosePrefix; + std::string DebugPrefix; + std::string WarningPrefix; + std::string ErrorPrefix; - std::ostream *m_DefaultOutput; - std::ostream *m_DefaultError; + std::ostream *DefaultOutput; + std::ostream *DefaultError; - std::string m_LogOutputFileName; - std::ostream *m_LogOutput; + std::string LogOutputFileName; + std::ostream *LogOutput; // Do we need to cleanup log output stream - bool m_LogOutputCleanup; + bool LogOutputCleanup; }; class cmCPackLogWrite diff --git a/Source/CPack/cmCPackNSISGenerator.cxx b/Source/CPack/cmCPackNSISGenerator.cxx index 8456c5b..6261960 100644 --- a/Source/CPack/cmCPackNSISGenerator.cxx +++ b/Source/CPack/cmCPackNSISGenerator.cxx @@ -9,8 +9,8 @@ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ @@ -99,7 +99,7 @@ int cmCPackNSISGenerator::CompressFiles(const char* outFileName, std::string output; int retVal = 1; bool res = cmSystemTools::RunSingleCommand(nsisCmd.c_str(), &output, - &retVal, 0, m_GeneratorVerbose, 0); + &retVal, 0, this->GeneratorVerbose, 0); if ( !res || retVal ) { cmGeneratedFileStream ofs(tmpFile.c_str()); @@ -147,7 +147,7 @@ int cmCPackNSISGenerator::Initialize(const char* name, cmMakefile* mf) std::string output; int retVal = 1; 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]+)"); if ( !resS || retVal || !versionRex.find(output)) diff --git a/Source/CPack/cmCPackNSISGenerator.h b/Source/CPack/cmCPackNSISGenerator.h index 3d8b2e5..c22f979 100644 --- a/Source/CPack/cmCPackNSISGenerator.h +++ b/Source/CPack/cmCPackNSISGenerator.h @@ -9,8 +9,8 @@ Copyright (c) 2002 Kitware, Inc. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ diff --git a/Source/CPack/cmCPackPackageMakerGenerator.cxx b/Source/CPack/cmCPackPackageMakerGenerator.cxx index 0c2e21a..b5d9951 100644 --- a/Source/CPack/cmCPackPackageMakerGenerator.cxx +++ b/Source/CPack/cmCPackPackageMakerGenerator.cxx @@ -95,7 +95,7 @@ int cmCPackPackageMakerGenerator::CompressFiles(const char* outFileName, std::string output; int retVal = 1; //bool res = cmSystemTools::RunSingleCommand(pkgCmd.str().c_str(), &output, - //&retVal, 0, m_GeneratorVerbose, 0); + //&retVal, 0, this->GeneratorVerbose, 0); bool res = true; retVal = system(pkgCmd.str().c_str()); cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Done running package maker" @@ -120,7 +120,7 @@ int cmCPackPackageMakerGenerator::CompressFiles(const char* outFileName, << "\" create -ov -format UDZO -srcfolder \"" << packageDirFileName << "\" \"" << outFileName << "\""; res = cmSystemTools::RunSingleCommand(dmgCmd.str().c_str(), &output, - &retVal, 0, m_GeneratorVerbose, 0); + &retVal, 0, this->GeneratorVerbose, 0); if ( !res || retVal ) { cmGeneratedFileStream ofs(tmpFile.c_str()); diff --git a/Source/CPack/cmCPackSTGZGenerator.cxx b/Source/CPack/cmCPackSTGZGenerator.cxx index 70deddc..96c4453 100644 --- a/Source/CPack/cmCPackSTGZGenerator.cxx +++ b/Source/CPack/cmCPackSTGZGenerator.cxx @@ -9,8 +9,8 @@ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ diff --git a/Source/CPack/cmCPackSTGZGenerator.h b/Source/CPack/cmCPackSTGZGenerator.h index 7be0176..bf7dec8 100644 --- a/Source/CPack/cmCPackSTGZGenerator.h +++ b/Source/CPack/cmCPackSTGZGenerator.h @@ -9,8 +9,8 @@ Copyright (c) 2002 Kitware, Inc. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ diff --git a/Source/CPack/cmCPackTGZGenerator.cxx b/Source/CPack/cmCPackTGZGenerator.cxx index 9c7ea94..4be3d43 100644 --- a/Source/CPack/cmCPackTGZGenerator.cxx +++ b/Source/CPack/cmCPackTGZGenerator.cxx @@ -9,8 +9,8 @@ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ @@ -60,13 +60,13 @@ class cmCPackTGZ_Data public: cmCPackTGZ_Data(cmCPackTGZGenerator* gen) : OutputStream(0), Generator(gen), - m_CompressionLevel(Z_DEFAULT_COMPRESSION) {} + CompressionLevel(Z_DEFAULT_COMPRESSION) {} std::ostream* OutputStream; cmCPackTGZGenerator* Generator; - char m_CompressedBuffer[cmCPackTGZ_Data_BlockSize]; - int m_CompressionLevel; - z_stream m_ZLibStream; - uLong m_CRC; + char CompressedBuffer[cmCPackTGZ_Data_BlockSize]; + int CompressionLevel; + z_stream ZLibStream; + uLong CRC; }; //---------------------------------------------------------------------- @@ -84,11 +84,11 @@ int cmCPackTGZ_Data_Open(void *client_data, const char* pathname, { cmCPackTGZ_Data *mydata = (cmCPackTGZ_Data*)client_data; - mydata->m_ZLibStream.zalloc = Z_NULL; - mydata->m_ZLibStream.zfree = Z_NULL; - mydata->m_ZLibStream.opaque = Z_NULL; + mydata->ZLibStream.zalloc = Z_NULL; + mydata->ZLibStream.zfree = Z_NULL; + mydata->ZLibStream.opaque = Z_NULL; 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 ) { return -1; @@ -102,13 +102,13 @@ int cmCPackTGZ_Data_Open(void *client_data, const char* pathname, { return -1; } - + if ( !cmCPackTGZGeneratorForward::GenerateHeader(mydata->Generator,gf)) { return -1; } - mydata->m_CRC = crc32(0L, Z_NULL, 0); + mydata->CRC = crc32(0L, Z_NULL, 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; - mydata->m_ZLibStream.avail_in = n; - mydata->m_ZLibStream.next_in = reinterpret_cast<Bytef*>(buff); + mydata->ZLibStream.avail_in = n; + mydata->ZLibStream.next_in = reinterpret_cast<Bytef*>(buff); do { - mydata->m_ZLibStream.avail_out = cmCPackTGZ_Data_BlockSize; - mydata->m_ZLibStream.next_out - = reinterpret_cast<Bytef*>(mydata->m_CompressedBuffer); + mydata->ZLibStream.avail_out = cmCPackTGZ_Data_BlockSize; + mydata->ZLibStream.next_out + = reinterpret_cast<Bytef*>(mydata->CompressedBuffer); // 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) { return 0; } size_t compressedSize - = cmCPackTGZ_Data_BlockSize - mydata->m_ZLibStream.avail_out; + = cmCPackTGZ_Data_BlockSize - mydata->ZLibStream.avail_out; mydata->OutputStream->write( - reinterpret_cast<const char*>(mydata->m_CompressedBuffer), + reinterpret_cast<const char*>(mydata->CompressedBuffer), compressedSize); - } while ( mydata->m_ZLibStream.avail_out == 0 ); + } while ( mydata->ZLibStream.avail_out == 0 ); if ( !*mydata->OutputStream ) { @@ -146,7 +146,7 @@ ssize_t cmCPackTGZ_Data_Write(void *client_data, void *buff, size_t 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; } @@ -160,19 +160,19 @@ int cmCPackTGZ_Data_Close(void *client_data) char buffer[8]; int n; - uLong x = mydata->m_CRC; + uLong x = mydata->CRC; for (n = 0; n < 4; n++) { buffer[n] = (int)(x & 0xff); x >>= 8; } - x = mydata->m_ZLibStream.total_in; + x = mydata->ZLibStream.total_in; for (n = 0; n < 4; n++) { buffer[n+4] = (int)(x & 0xff); x >>= 8; } mydata->OutputStream->write(buffer, 8); - (void)deflateEnd(&mydata->m_ZLibStream); + (void)deflateEnd(&mydata->ZLibStream); delete mydata->OutputStream; mydata->OutputStream = 0; return (0); @@ -204,7 +204,7 @@ int cmCPackTGZGenerator::CompressFiles(const char* outFileName, if (tar_open(&t, realName, &gztype, flags, 0644, - (m_GeneratorVerbose?TAR_VERBOSE:0) + (this->GeneratorVerbose?TAR_VERBOSE:0) | 0) == -1) { cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem with tar_open(): " diff --git a/Source/CPack/cmCPackTGZGenerator.h b/Source/CPack/cmCPackTGZGenerator.h index d411096..a486a24 100644 --- a/Source/CPack/cmCPackTGZGenerator.h +++ b/Source/CPack/cmCPackTGZGenerator.h @@ -9,8 +9,8 @@ Copyright (c) 2002 Kitware, Inc. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ diff --git a/Source/CPack/cpack.cxx b/Source/CPack/cpack.cxx index e02aabf..c44959a 100644 --- a/Source/CPack/cpack.cxx +++ b/Source/CPack/cpack.cxx @@ -9,8 +9,8 @@ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ @@ -105,12 +105,12 @@ int cpackUnknownArgument(const char*, void*) struct cpackDefinitions { typedef std::map<cmStdString, cmStdString> MapType; - MapType m_Map; - cmCPackLog *m_Log; + MapType Map; + cmCPackLog *Log; }; //---------------------------------------------------------------------------- -int cpackDefinitionArgument(const char* argument, const char* cValue, +int cpackDefinitionArgument(const char* argument, const char* cValue, void* call_data) { (void)argument; @@ -119,14 +119,14 @@ int cpackDefinitionArgument(const char* argument, const char* cValue, size_t pos = value.find_first_of("="); 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); return 0; } std::string key = value.substr(0, pos); value = value.c_str() + pos + 1; - def->m_Map[key] = value; - cmCPack_Log(def->m_Log, cmCPackLog::LOG_DEBUG, "Set CPack variable: " + def->Map[key] = value; + cmCPack_Log(def->Log, cmCPackLog::LOG_DEBUG, "Set CPack variable: " << key.c_str() << " to \"" << value.c_str() << "\"" << std::endl); return 1; } @@ -168,7 +168,7 @@ int main (int argc, char *argv[]) std::string cpackConfigFile; cpackDefinitions definitions; - definitions.m_Log = &log; + definitions.Log = &log; cpackConfigFile = ""; @@ -296,8 +296,8 @@ int main (int argc, char *argv[]) mf->AddDefinition("CPACK_BUILD_CONFIG", cpackBuildConfig.c_str()); } cpackDefinitions::MapType::iterator cdit; - for ( cdit = definitions.m_Map.begin(); - cdit != definitions.m_Map.end(); + for ( cdit = definitions.Map.begin(); + cdit != definitions.Map.end(); ++cdit ) { mf->AddDefinition(cdit->first.c_str(), cdit->second.c_str()); diff --git a/Source/cmAddCustomCommandCommand.cxx b/Source/cmAddCustomCommandCommand.cxx index 845a268..f8b1ea1 100644 --- a/Source/cmAddCustomCommandCommand.cxx +++ b/Source/cmAddCustomCommandCommand.cxx @@ -9,8 +9,8 @@ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ @@ -19,7 +19,8 @@ #include "cmTarget.h" // 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 arg. For the moment, let's say that COMMAND, and either TARGET or SOURCE @@ -42,7 +43,7 @@ bool cmAddCustomCommandCommand::InitialPass(std::vector<std::string> const& args cmCustomCommandLines commandLines; cmTarget::CustomCommandType cctype = cmTarget::POST_BUILD; - + enum tdoing { doing_source, doing_command, @@ -198,7 +199,8 @@ bool cmAddCustomCommandCommand::InitialPass(std::vector<std::string> const& args 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; } diff --git a/Source/cmAddCustomTargetCommand.cxx b/Source/cmAddCustomTargetCommand.cxx index a2a54e8..13ef987 100644 --- a/Source/cmAddCustomTargetCommand.cxx +++ b/Source/cmAddCustomTargetCommand.cxx @@ -9,15 +9,16 @@ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #include "cmAddCustomTargetCommand.h" // cmAddCustomTargetCommand -bool cmAddCustomTargetCommand::InitialPass(std::vector<std::string> const& args) +bool cmAddCustomTargetCommand::InitialPass( + std::vector<std::string> const& args) { if(args.size() < 1 ) { @@ -118,7 +119,7 @@ bool cmAddCustomTargetCommand::InitialPass(std::vector<std::string> const& args) // Add the utility target to the makefile. const char* no_output = 0; - m_Makefile->AddUtilityCommand(args[0].c_str(), all, no_output, + m_Makefile->AddUtilityCommand(args[0].c_str(), all, no_output, working_directory.c_str(), depends, commandLines); diff --git a/Source/cmAddDefinitionsCommand.cxx b/Source/cmAddDefinitionsCommand.cxx index 5067e3f..7034a43 100644 --- a/Source/cmAddDefinitionsCommand.cxx +++ b/Source/cmAddDefinitionsCommand.cxx @@ -9,15 +9,16 @@ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #include "cmAddDefinitionsCommand.h" // 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 if(args.size() < 1 ) diff --git a/Source/cmAddDefinitionsCommand.h b/Source/cmAddDefinitionsCommand.h index f2ab1a3..cd4343e 100644 --- a/Source/cmAddDefinitionsCommand.h +++ b/Source/cmAddDefinitionsCommand.h @@ -9,8 +9,8 @@ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ @@ -22,8 +22,8 @@ /** \class cmAddDefinitionsCommand * \brief Specify a list of compiler defines * - * cmAddDefinitionsCommand specifies a list of compiler defines. These defines will - * be added to the compile command. + * cmAddDefinitionsCommand specifies a list of compiler defines. These defines + * will be added to the compile command. */ class cmAddDefinitionsCommand : public cmCommand { @@ -31,7 +31,7 @@ public: /** * This is a virtual constructor for the command. */ - virtual cmCommand* Clone() + virtual cmCommand* Clone() { return new cmAddDefinitionsCommand; } @@ -46,15 +46,15 @@ public: * The name of the command as specified in CMakeList.txt. */ virtual const char* GetName() {return "ADD_DEFINITIONS";} - + /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() { return "Adds -D define flags to the command line of C and C++ compilers."; } - + /** * More documentation. */ @@ -67,7 +67,7 @@ public: "but the -D flag is accepted most C/C++ compilers. " "Other flags may not be as portable."; } - + cmTypeMacro(cmAddDefinitionsCommand, cmCommand); }; diff --git a/Source/cmAddDependenciesCommand.cxx b/Source/cmAddDependenciesCommand.cxx index cfae2ce..e81014d 100644 --- a/Source/cmAddDependenciesCommand.cxx +++ b/Source/cmAddDependenciesCommand.cxx @@ -9,15 +9,16 @@ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #include "cmAddDependenciesCommand.h" // cmDependenciesCommand -bool cmAddDependenciesCommand::InitialPass(std::vector<std::string> const& args) +bool cmAddDependenciesCommand::InitialPass( + std::vector<std::string> const& args) { if(args.size() < 2 ) { @@ -44,7 +45,7 @@ bool cmAddDependenciesCommand::InitialPass(std::vector<std::string> const& args) this->SetError(error.c_str()); return false; } - + return true; } diff --git a/Source/cmAddExecutableCommand.h b/Source/cmAddExecutableCommand.h index a3fe568..77140c5 100644 --- a/Source/cmAddExecutableCommand.h +++ b/Source/cmAddExecutableCommand.h @@ -9,8 +9,8 @@ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ @@ -31,7 +31,7 @@ public: /** * This is a virtual constructor for the command. */ - virtual cmCommand* Clone() + virtual cmCommand* Clone() { return new cmAddExecutableCommand; } @@ -50,11 +50,12 @@ public: /** * Succinct documentation. */ - 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."; } - + /** * More documentation. */ @@ -68,15 +69,15 @@ public: "specified.\n" "After specifying the executable name, WIN32 and/or MACOSX_BUNDLE can " "be specified. WIN32 indicates that the executable (when compiled on " - "windows) is a windows app (using WinMain) not a console app (using main). " - "The variable CMAKE_MFC_FLAG be used if the windows app uses MFC. " - "This variable can be set to the following values:\n" + "windows) is a windows app (using WinMain) not a console app " + "(using main). The variable CMAKE_MFC_FLAG be used if the windows app " + "uses MFC. This variable can be set to the following values:\n" " 0: Use Standard Windows Libraries\n" " 1: Use MFC in a Static Library \n" " 2: Use MFC in a Shared DLL \n" "MACOSX_BUNDLE indicates that when build on Mac OSX, executable should " - "be in the bundle form. The MACOSX_BUNDLE also allows several variables " - "to be specified:\n" + "be in the bundle form. The MACOSX_BUNDLE also allows several " + "variables to be specified:\n" " MACOSX_BUNDLE_INFO_STRING\n" " MACOSX_BUNDLE_ICON_FILE\n" " MACOSX_BUNDLE_GUI_IDENTIFIER\n" @@ -87,7 +88,7 @@ public: " MACOSX_BUNDLE_COPYRIGHT\n" ; } - + cmTypeMacro(cmAddExecutableCommand, cmCommand); }; diff --git a/Source/cmBuildCommand.cxx b/Source/cmBuildCommand.cxx index 382ba6b..745583c 100644 --- a/Source/cmBuildCommand.cxx +++ b/Source/cmBuildCommand.cxx @@ -9,8 +9,8 @@ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ @@ -32,8 +32,9 @@ bool cmBuildCommand::InitialPass(std::vector<std::string> const& args) = m_Makefile->GetDefinition(define); std::string makeprogram = args[1]; std::string makecommand - = m_Makefile->GetLocalGenerator()->GetGlobalGenerator()->GenerateBuildCommand( - makeprogram.c_str(), m_Makefile->GetProjectName(), 0, + = m_Makefile->GetLocalGenerator() + ->GetGlobalGenerator()->GenerateBuildCommand( + makeprogram.c_str(), m_Makefile->GetProjectName(), 0, 0, "Release", true); if(cacheValue) diff --git a/Source/cmBuildNameCommand.h b/Source/cmBuildNameCommand.h index cf61be3..183b097 100644 --- a/Source/cmBuildNameCommand.h +++ b/Source/cmBuildNameCommand.h @@ -9,8 +9,8 @@ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ @@ -22,7 +22,7 @@ /** \class cmBuildNameCommand * \brief BuildName a CMAKE variable * - * cmBuildNameCommand sets a variable to a value with expansion. + * cmBuildNameCommand sets a variable to a value with expansion. */ class cmBuildNameCommand : public cmCommand { @@ -30,7 +30,7 @@ public: /** * This is a virtual constructor for the command. */ - virtual cmCommand* Clone() + virtual cmCommand* Clone() { return new cmBuildNameCommand; } @@ -50,15 +50,16 @@ public: * The name of the command as specified in CMakeList.txt. */ virtual const char* GetName() {return "BUILD_NAME";} - + /** * Succinct documentation. */ - 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."; } - + /** * More documentation. */ @@ -70,7 +71,7 @@ public: "and compiler settings. These values are now available through the " "CMAKE_SYSTEM and CMAKE_CXX_COMPILER variables."; } - + cmTypeMacro(cmBuildNameCommand, cmCommand); }; diff --git a/Source/cmCMakeMinimumRequired.cxx b/Source/cmCMakeMinimumRequired.cxx index 76dc796..b4f4ead 100644 --- a/Source/cmCMakeMinimumRequired.cxx +++ b/Source/cmCMakeMinimumRequired.cxx @@ -9,8 +9,8 @@ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ @@ -67,7 +67,8 @@ bool cmCMakeMinimumRequired::InitialPass(std::vector<std::string> const& args) } // 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. int current_major = m_Makefile->GetMajorVersion(); @@ -102,9 +103,11 @@ bool cmCMakeMinimumRequired::InitialPass(std::vector<std::string> const& args) { 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 " - << current_major << "." << current_minor << "." << current_patch << ".\n"; + << current_major << "." << current_minor << "." << current_patch + << ".\n"; if(fatal_error) { cmSystemTools::Error(e.str().c_str()); diff --git a/Source/cmCPluginAPI.cxx b/Source/cmCPluginAPI.cxx index 63b379a..a302add 100644 --- a/Source/cmCPluginAPI.cxx +++ b/Source/cmCPluginAPI.cxx @@ -9,12 +9,12 @@ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ -/* +/* this file contains the implementation of the C API to CMake. Generally these routines just manipulate arguments and then call the associated methods on the CMake classes. */ @@ -24,9 +24,9 @@ #include "cmSourceFile.h" -extern "C" +extern "C" { - + void CCONV *cmGetClientData(void *info) { return ((cmLoadedCommandInfo *)info)->ClientData; @@ -74,12 +74,11 @@ void CCONV cmAddDefinition(void *arg, const char* name, const char* value) } /* Add a definition to this makefile and the global cmake cache. */ -void CCONV cmAddCacheDefinition(void *arg, const char* name, const char* value, - const char* doc, - int type) +void CCONV cmAddCacheDefinition(void *arg, const char* name, + const char* value, const char* doc, int type) { cmMakefile *mf = static_cast<cmMakefile *>(arg); - + switch (type) { case CM_CACHE_BOOL: @@ -135,7 +134,7 @@ const char* CCONV cmGetStartOutputDirectory(void *arg) cmMakefile *mf = static_cast<cmMakefile *>(arg); return mf->GetStartOutputDirectory(); } -const char* CCONV cmGetCurrentDirectory(void *arg) +const char* CCONV cmGetCurrentDirectory(void *arg) { cmMakefile *mf = static_cast<cmMakefile *>(arg); return mf->GetCurrentDirectory(); @@ -170,14 +169,15 @@ void CCONV cmAddDefineFlag(void *arg, const char* 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); mf->AddLinkDirectoryForTarget(tgt,d); } -void CCONV cmAddExecutable(void *arg, const char *exename, +void CCONV cmAddExecutable(void *arg, const char *exename, int numSrcs, const char **srcs, int win32) { cmMakefile *mf = static_cast<cmMakefile *>(arg); @@ -368,11 +368,11 @@ void CCONV cmAddCustomCommandToTarget(void *arg, const char* target, cctype, no_comment, no_working_dir); } -void CCONV cmAddLinkLibraryForTarget(void *arg, const char *tgt, const char*value, - int libtype) +void CCONV cmAddLinkLibraryForTarget(void *arg, const char *tgt, + const char*value, int libtype) { cmMakefile *mf = static_cast<cmMakefile *>(arg); - + switch (libtype) { case CM_LIBRARY_GENERAL: @@ -400,13 +400,13 @@ void CCONV cmAddLibrary(void *arg, const char *libname, int shared, mf->AddLibrary(libname, (shared ? true : false), srcs2); } -char CCONV *cmExpandVariablesInString(void *arg, const char *source, +char CCONV *cmExpandVariablesInString(void *arg, const char *source, int escapeQuotes, int atOnly) { cmMakefile *mf = static_cast<cmMakefile *>(arg); std::string barf = source; - std::string result = - mf->ExpandVariablesInString(barf, + std::string result = + mf->ExpandVariablesInString(barf, (escapeQuotes ? true : false), (atOnly ? true : false)); char *res = static_cast<char *>(malloc(result.size() + 1)); @@ -419,7 +419,7 @@ char CCONV *cmExpandVariablesInString(void *arg, const char *source, } -int CCONV cmExecuteCommand(void *arg, const char *name, +int CCONV cmExecuteCommand(void *arg, const char *name, int numArgs, const char **args) { cmMakefile *mf = static_cast<cmMakefile *>(arg); @@ -434,7 +434,7 @@ int CCONV cmExecuteCommand(void *arg, const char *name, return mf->ExecuteCommand(lff); } -void CCONV cmExpandSourceListArguments(void *arg, +void CCONV cmExpandSourceListArguments(void *arg, int numArgs, const char **args, int *resArgc, @@ -540,7 +540,8 @@ int CCONV cmSourceFileGetPropertyAsBool(void *arg,const char *prop) 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); sf->SetProperty(prop,val); @@ -573,7 +574,7 @@ void CCONV cmSourceFileSetName(void *arg, const char* name, const char* dir, sf->SetName(name,dir, srcs, hdrs); } -void CCONV cmSourceFileSetName2(void *arg, const char* name, const char* dir, +void CCONV cmSourceFileSetName2(void *arg, const char* name, const char* dir, const char *ext, int headerFileOnly) { cmSourceFile *sf = static_cast<cmSourceFile *>(arg); @@ -584,7 +585,7 @@ void CCONV cmSourceFileSetName2(void *arg, const char* name, const char* dir, char * CCONV cmGetFilenameWithoutExtension(const char *name) { std::string sres = cmSystemTools::GetFilenameWithoutExtension(name); - char *result = (char *)malloc(sres.size()+1); + char *result = (char *)malloc(sres.size()+1); strcpy(result,sres.c_str()); return result; } @@ -592,7 +593,7 @@ char * CCONV cmGetFilenameWithoutExtension(const char *name) char * CCONV cmGetFilenamePath(const char *name) { std::string sres = cmSystemTools::GetFilenamePath(name); - char *result = (char *)malloc(sres.size()+1); + char *result = (char *)malloc(sres.size()+1); strcpy(result,sres.c_str()); return result; } @@ -600,7 +601,7 @@ char * CCONV cmGetFilenamePath(const char *name) char * CCONV cmCapitalized(const char *name) { std::string sres = cmSystemTools::Capitalized(name); - char *result = (char *)malloc(sres.size()+1); + char *result = (char *)malloc(sres.size()+1); strcpy(result,sres.c_str()); return result; } @@ -661,7 +662,7 @@ cmCAPI cmStaticCAPI = cmGetStartDirectory, cmGetStartOutputDirectory, cmIsOn, - + cmAddSource, cmCreateSourceFile, cmDestroySourceFile, @@ -674,7 +675,7 @@ cmCAPI cmStaticCAPI = cmSourceFileSetName, cmSourceFileSetName2, cmSourceFileSetProperty, - + cmCapitalized, cmCopyFileIfDifferent, cmGetFilenameWithoutExtension, diff --git a/Source/cmCPluginAPI.h b/Source/cmCPluginAPI.h index 2910028..76dbe4c 100644 --- a/Source/cmCPluginAPI.h +++ b/Source/cmCPluginAPI.h @@ -9,18 +9,18 @@ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ /* This header file defines the API that loadable commands can use. In many - of these commands C++ instances of cmMakefile of cmSourceFile are passed - in as arguments or returned. In these cases they are passed as a void * - argument. In the function prototypes mf is used to represent a makefile - and sf is used to represent a source file. The functions are grouped - loosely into four groups 1) Utility 2) cmMakefile 3) cmSourceFile 4) - cmSystemTools. Within each grouping functions are listed alphabetically */ + of these commands C++ instances of cmMakefile of cmSourceFile are passed + in as arguments or returned. In these cases they are passed as a void * + argument. In the function prototypes mf is used to represent a makefile + and sf is used to represent a source file. The functions are grouped + loosely into four groups 1) Utility 2) cmMakefile 3) cmSourceFile 4) + cmSystemTools. Within each grouping functions are listed alphabetically */ /*=========================================================================*/ #ifndef cmCPluginAPI_h #define cmCPluginAPI_h @@ -42,7 +42,7 @@ this is the structure of function entry points that a plugin may call. This structure must be kept in sync with the static decaled at the bottom of cmCPLuginAPI.cxx =========================================================================*/ -typedef struct +typedef struct { /*========================================================================= Here we define the set of functions that a plugin may call. The first goup @@ -62,14 +62,14 @@ typedef struct void (CCONV *SetClientData) (void *info, void *cd); /* when an error occurs, call this function to set the error string */ void (CCONV *SetError) (void *info, const char *err); - + /*========================================================================= The following functions all directly map to methods in the cmMakefile class. See cmMakefile.h for descriptions of what each method does. All of these methods take the void * makefile pointer as their first argument. =========================================================================*/ - void (CCONV *AddCacheDefinition) (void *mf, const char* name, - const char* value, + void (CCONV *AddCacheDefinition) (void *mf, const char* name, + const char* value, const char* doc, int cachetype); void (CCONV *AddCustomCommand) (void *mf, const char* source, const char* command, @@ -78,26 +78,28 @@ typedef struct int numOutputs, const char **outputs, const char *target); void (CCONV *AddDefineFlag) (void *mf, const char* definition); - void (CCONV *AddDefinition) (void *mf, const char* name, const char* value); - void (CCONV *AddExecutable) (void *mf, const char *exename, + void (CCONV *AddDefinition) (void *mf, const char* name, + const char* value); + void (CCONV *AddExecutable) (void *mf, const char *exename, int numSrcs, const char **srcs, int win32); - void (CCONV *AddLibrary) (void *mf, const char *libname, + void (CCONV *AddLibrary) (void *mf, const char *libname, int shared, int numSrcs, const char **srcs); - void (CCONV *AddLinkDirectoryForTarget) (void *mf, const char *tgt, + void (CCONV *AddLinkDirectoryForTarget) (void *mf, const char *tgt, const char* d); - void (CCONV *AddLinkLibraryForTarget) (void *mf, const char *tgt, + void (CCONV *AddLinkLibraryForTarget) (void *mf, const char *tgt, const char *libname, int libtype); void (CCONV *AddUtilityCommand) (void *mf, const char* utilityName, const char *command, const char *arguments, int all, int numDepends, const char **depends, int numOutputs, const char **outputs); 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); - void (CCONV *ExpandSourceListArguments) (void *mf,int argc, const char **argv, + void (CCONV *ExpandSourceListArguments) (void *mf,int argc, + const char **argv, int *resArgc, char ***resArgv, unsigned int startArgumentIndex); - char *(CCONV *ExpandVariablesInString) (void *mf, const char *source, + char *(CCONV *ExpandVariablesInString) (void *mf, const char *source, int escapeQuotes, int atOnly); unsigned int (CCONV *GetCacheMajorVersion) (void *mf); unsigned int (CCONV *GetCacheMinorVersion) (void *mf); @@ -112,14 +114,14 @@ typedef struct const char* (CCONV *GetStartDirectory) (void *mf); const char* (CCONV *GetStartOutputDirectory) (void *mf); int (CCONV *IsOn) (void *mf, const char* name); - - + + /*========================================================================= The following functions are designed to operate or manipulate cmSourceFiles. Please see cmSourceFile.h for additional information on many of these methods. Some of these methods are in cmMakefile.h. =========================================================================*/ - void *(CCONV *AddSource) (void *mf, void *sf); + void *(CCONV *AddSource) (void *mf, void *sf); void *(CCONV *CreateSourceFile) (); void (CCONV *DestroySourceFile) (void *sf); void *(CCONV *GetSource) (void *mf, const char* sourceName); @@ -128,17 +130,19 @@ typedef struct int (CCONV *SourceFileGetPropertyAsBool) (void *sf, const char *prop); const char *(CCONV *SourceFileGetSourceName) (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, const char **sourceExtensions, int numHeaderExtensions, 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); void (CCONV *SourceFileSetProperty) (void *sf, const char *prop, const char *value); - - + + /*========================================================================= The following methods are from cmSystemTools.h see that file for specific documentation on each method. @@ -149,7 +153,7 @@ typedef struct char *(CCONV *GetFilenamePath)(const char *); void (CCONV *RemoveFile)(const char *f1); void (CCONV *Free)(void *); - + /*========================================================================= The following are new functions added after 1.6 =========================================================================*/ @@ -162,21 +166,21 @@ typedef struct const char* command, int numArgs, const char **args, int commandType); - + /* display status information */ void (CCONV *DisplaySatus) (void *info, const char *message); - /* this is the end of the C function stub API structure */ + /* this is the end of the C function stub API structure */ } cmCAPI; - + /*========================================================================= CM_PLUGIN_EXPORT should be used by plugins =========================================================================*/ #ifdef _WIN32 #define CM_PLUGIN_EXPORT __declspec( dllexport ) #else -#define CM_PLUGIN_EXPORT +#define CM_PLUGIN_EXPORT #endif /*========================================================================= @@ -203,16 +207,16 @@ define the different types of custom commands for a target #define CM_PRE_BUILD 0 #define CM_PRE_LINK 1 #define CM_POST_BUILD 2 - + /*========================================================================= Finally we define the key data structures and function prototypes =========================================================================*/ typedef const char* (CCONV *CM_DOC_FUNCTION)(); - typedef int (CCONV *CM_INITIAL_PASS_FUNCTION)(void *info, void *mf, + typedef int (CCONV *CM_INITIAL_PASS_FUNCTION)(void *info, void *mf, int argc, char *[]); typedef void (CCONV *CM_FINAL_PASS_FUNCTION)(void *info, void *mf); typedef void (CCONV *CM_DESTRUCTOR_FUNCTION)(void *info); - + typedef struct { unsigned long reserved1; /* Reserved for future use. DO NOT USE. */ unsigned long reserved2; /* Reserved for future use. DO NOT USE. */ @@ -222,14 +226,14 @@ Finally we define the key data structures and function prototypes CM_FINAL_PASS_FUNCTION FinalPass; CM_DESTRUCTOR_FUNCTION Destructor; CM_DOC_FUNCTION GetTerseDocumentation; - CM_DOC_FUNCTION GetFullDocumentation; + CM_DOC_FUNCTION GetFullDocumentation; const char *Name; char *Error; void *ClientData; } cmLoadedCommandInfo; typedef void (CCONV *CM_INIT_FUNCTION)(cmLoadedCommandInfo *); - + #ifdef __cplusplus } #endif diff --git a/Source/cmCacheManager.cxx b/Source/cmCacheManager.cxx index 6be0c35..f7d576b 100644 --- a/Source/cmCacheManager.cxx +++ b/Source/cmCacheManager.cxx @@ -9,8 +9,8 @@ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ @@ -28,7 +28,7 @@ # include <windows.h> #endif // _WIN32 -const char* cmCacheManagerTypes[] = +const char* cmCacheManagerTypes[] = { "BOOL", "PATH", "FILEPATH", @@ -80,14 +80,16 @@ bool cmCacheManager::LoadCache(const char* path, return this->LoadCache(path, internal, emptySet, emptySet); } -bool cmCacheManager::ParseEntry(const char* entry, +bool cmCacheManager::ParseEntry(const char* entry, std::string& var, std::string& 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 - static cmsys::RegularExpression regQuoted("^\"([^\"]*)\"=(.*[^\r\t ]|[\r\t ]*)[\r\t ]*$"); + static cmsys::RegularExpression regQuoted( + "^\"([^\"]*)\"=(.*[^\r\t ]|[\r\t ]*)[\r\t ]*$"); bool flag = false; if(regQuoted.find(entry)) { @@ -104,27 +106,29 @@ bool cmCacheManager::ParseEntry(const char* entry, // if value is enclosed in single quotes ('foo') then remove them // it is used to enclose trailing space or tab - if (flag && + if (flag && value.size() >= 2 && - value[0] == '\'' && - value[value.size() - 1] == '\'') + value[0] == '\'' && + value[value.size() - 1] == '\'') { - value = value.substr(1, + value = value.substr(1, value.size() - 2); } return flag; } -bool cmCacheManager::ParseEntry(const char* entry, +bool cmCacheManager::ParseEntry(const char* entry, std::string& var, std::string& value, CacheEntryType& type) { // 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 - static cmsys::RegularExpression regQuoted("^\"([^\"]*)\":([^=]*)=(.*[^\r\t ]|[\r\t ]*)[\r\t ]*$"); + static cmsys::RegularExpression regQuoted( + "^\"([^\"]*)\":([^=]*)=(.*[^\r\t ]|[\r\t ]*)[\r\t ]*$"); bool flag = false; if(regQuoted.find(entry)) { @@ -143,12 +147,12 @@ bool cmCacheManager::ParseEntry(const char* entry, // if value is enclosed in single quotes ('foo') then remove them // it is used to enclose trailing space or tab - if (flag && + if (flag && value.size() >= 2 && - value[0] == '\'' && - value[value.size() - 1] == '\'') + value[0] == '\'' && + value[value.size() - 1] == '\'') { - value = value.substr(1, + value = value.substr(1, value.size() - 2); } @@ -186,7 +190,7 @@ bool cmCacheManager::LoadCache(const char* path, this->CleanCMakeFiles(path); return false; } - + std::ifstream fin(cacheFile.c_str()); if(!fin) { @@ -232,7 +236,7 @@ bool cmCacheManager::LoadCache(const char* path, // If the entry is not internal to the cache being loaded // or if it is in the list of internal entries to be // imported, load it. - if ( internal || (e.m_Type != INTERNAL) || + if ( internal || (e.m_Type != INTERNAL) || (includes.find(entryKey) != includes.end()) ) { // If we are loading the cache from another project, @@ -250,12 +254,14 @@ bool cmCacheManager::LoadCache(const char* path, } if ( e.m_Type == cmCacheManager::INTERNAL && (entryKey.size() > strlen("-ADVANCED")) && - strcmp(entryKey.c_str() + (entryKey.size() - strlen("-ADVANCED")), - "-ADVANCED") == 0 ) + strcmp(entryKey.c_str() + (entryKey.size() - + strlen("-ADVANCED")), "-ADVANCED") == 0 ) { std::string value = e.m_Value; - std::string akey = entryKey.substr(0, (entryKey.size() - strlen("-ADVANCED"))); - cmCacheManager::CacheIterator it = this->GetCacheIterator(akey.c_str()); + std::string akey + = entryKey.substr(0, (entryKey.size() - strlen("-ADVANCED"))); + cmCacheManager::CacheIterator it + = this->GetCacheIterator(akey.c_str()); if ( it.IsAtEnd() ) { e.m_Type = cmCacheManager::UNINITIALIZED; @@ -269,12 +275,14 @@ bool cmCacheManager::LoadCache(const char* path, } else if ( e.m_Type == cmCacheManager::INTERNAL && (entryKey.size() > strlen("-MODIFIED")) && - strcmp(entryKey.c_str() + (entryKey.size() - strlen("-MODIFIED")), - "-MODIFIED") == 0 ) + strcmp(entryKey.c_str() + (entryKey.size() - + strlen("-MODIFIED")), "-MODIFIED") == 0 ) { std::string value = e.m_Value; - std::string akey = entryKey.substr(0, (entryKey.size() - strlen("-MODIFIED"))); - cmCacheManager::CacheIterator it = this->GetCacheIterator(akey.c_str()); + std::string akey + = entryKey.substr(0, (entryKey.size() - strlen("-MODIFIED"))); + cmCacheManager::CacheIterator it + = this->GetCacheIterator(akey.c_str()); if ( it.IsAtEnd() ) { e.m_Type = cmCacheManager::UNINITIALIZED; @@ -310,7 +318,7 @@ bool cmCacheManager::LoadCache(const char* path, this->AddCacheEntry("CMAKE_CACHE_MAJOR_VERSION", "0", "Major version of cmake used to create the " "current loaded cache", cmCacheManager::INTERNAL); - + } // check to make sure the cache directory has not // been moved @@ -322,27 +330,27 @@ bool cmCacheManager::LoadCache(const char* path, currentcwd += "/CMakeCache.txt"; oldcwd += "/CMakeCache.txt"; if(!cmSystemTools::SameFile(oldcwd.c_str(), currentcwd.c_str())) - { - std::string message = + { + std::string message = std::string("The current CMakeCache.txt directory ") + - currentcwd + std::string(" is different than the directory ") + + currentcwd + std::string(" is different than the directory ") + std::string(this->GetCacheValue("CMAKE_CACHEFILE_DIR")) + std::string(" where CMackeCache.txt was created. This may result " "in binaries being created in the wrong place. If you " "are not sure, reedit the CMakeCache.txt"); - cmSystemTools::Error(message.c_str()); + cmSystemTools::Error(message.c_str()); } } return true; } -bool cmCacheManager::SaveCache(cmMakefile* mf) +bool cmCacheManager::SaveCache(cmMakefile* mf) { return this->SaveCache(mf->GetHomeOutputDirectory()); } -bool cmCacheManager::SaveCache(const char* path) +bool cmCacheManager::SaveCache(const char* path) { std::string cacheFile = path; cacheFile += "/CMakeCache.txt"; @@ -350,14 +358,14 @@ bool cmCacheManager::SaveCache(const char* path) tempFile += ".tmp"; std::ofstream fout(tempFile.c_str()); if(!fout) - { - cmSystemTools::Error("Unable to open cache file for save. ", + { + cmSystemTools::Error("Unable to open cache file for save. ", cacheFile.c_str()); cmSystemTools::ReportLastSystemError(""); return false; } // before writing the cache, update the version numbers - // to the + // to the char temp[1024]; sprintf(temp, "%d", cmMakefile::GetMinorVersion()); this->AddCacheEntry("CMAKE_CACHE_MINOR_VERSION", temp, @@ -368,7 +376,8 @@ bool cmCacheManager::SaveCache(const char* path) "Major version of cmake used to create the " "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 " "current loaded cache", cmCacheManager::INTERNAL); @@ -387,19 +396,25 @@ bool cmCacheManager::SaveCache(const char* path) fout << "# This is the CMakeCache file.\n" << "# For build in directory: " << currentcwd << "\n"; - cmCacheManager::CacheEntry* cmakeCacheEntry = this->GetCacheEntry("CMAKE_COMMAND"); + cmCacheManager::CacheEntry* cmakeCacheEntry + = this->GetCacheEntry("CMAKE_COMMAND"); 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" - << "# If you do not want to change any of the values, simply exit the editor.\n" - << "# If you do want to change a value, simply edit, save, and exit the editor.\n" + fout << "# You can edit this file to change values found and used by cmake." + << std::endl + << "# 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" << "# KEY:TYPE=VALUE\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"; fout << "########################\n"; @@ -410,20 +425,20 @@ bool cmCacheManager::SaveCache(const char* path) for( std::map<cmStdString, CacheEntry>::const_iterator i = m_Cache.begin(); i != m_Cache.end(); ++i) { - const CacheEntry& ce = (*i).second; + const CacheEntry& ce = (*i).second; CacheEntryType t = ce.m_Type; if(t == cmCacheManager::UNINITIALIZED || !ce.m_Initialized) { /* // This should be added in, but is not for now. - cmSystemTools::Error("Cache entry \"", (*i).first.c_str(), + cmSystemTools::Error("Cache entry \"", (*i).first.c_str(), "\" is uninitialized"); */ } else if(t != INTERNAL) { // Format is key:type=value - std::map<cmStdString,cmStdString>::const_iterator it = + std::map<cmStdString,cmStdString>::const_iterator it = ce.m_Properties.find("HELPSTRING"); if ( it == ce.m_Properties.end() ) { @@ -434,7 +449,7 @@ bool cmCacheManager::SaveCache(const char* path) cmCacheManager::OutputHelpString(fout, it->second); } std::string key; - // support : in key name by double quoting + // support : in key name by double quoting if((*i).first.find(':') != std::string::npos || (*i).first.find("//") == 0) { @@ -450,7 +465,7 @@ bool cmCacheManager::SaveCache(const char* path) << cmCacheManagerTypes[t] << "="; // if value has trailing space or tab, enclose it in single quotes if (ce.m_Value.size() && - (ce.m_Value[ce.m_Value.size() - 1] == ' ' || + (ce.m_Value[ce.m_Value.size() - 1] == ' ' || ce.m_Value[ce.m_Value.size() - 1] == '\t')) { fout << '\'' << ce.m_Value << '\''; @@ -491,7 +506,7 @@ bool cmCacheManager::SaveCache(const char* path) helpstring += i.GetName(); rkey += "-ADVANCED"; cmCacheManager::OutputHelpString(fout, helpstring.c_str()); - // support : in key name by double quoting + // support : in key name by double quoting if(rkey.find(':') != std::string::npos || rkey.find("//") == 0) { @@ -519,7 +534,7 @@ bool cmCacheManager::SaveCache(const char* path) helpstring += i.GetName(); rkey += "-MODIFIED"; cmCacheManager::OutputHelpString(fout, helpstring.c_str()); - // support : in key name by double quoting + // support : in key name by double quoting if(rkey.find(':') != std::string::npos || rkey.find("//") == 0) { @@ -550,7 +565,7 @@ bool cmCacheManager::SaveCache(const char* path) helpstring = ""; } cmCacheManager::OutputHelpString(fout, helpstring.c_str()); - // support : in key name by double quoting + // support : in key name by double quoting if(rkey.find(':') != std::string::npos || rkey.find("//") == 0) { @@ -567,7 +582,7 @@ bool cmCacheManager::SaveCache(const char* path) // if value has trailing space or tab, enclose it in single quotes std::string value = i.GetValue(); if (value.size() && - (value[value.size() - 1] == ' ' || + (value[value.size() - 1] == ' ' || value[value.size() - 1] == '\t')) { fout << '\'' << value << '\''; @@ -576,7 +591,7 @@ bool cmCacheManager::SaveCache(const char* path) { fout << value; } - fout << "\n"; + fout << "\n"; } } fout << "\n"; @@ -591,15 +606,16 @@ bool cmCacheManager::SaveCache(const char* path) std::ofstream checkCache(checkCacheFile.c_str()); if(!checkCache) { - cmSystemTools::Error("Unable to open check cache file for write. ", + cmSystemTools::Error("Unable to open check cache file for write. ", checkCacheFile.c_str()); 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; } -bool cmCacheManager::DeleteCache(const char* path) +bool cmCacheManager::DeleteCache(const char* path) { std::string cacheFile = path; cmSystemTools::ConvertToUnixSlashes(cacheFile); @@ -611,7 +627,9 @@ bool cmCacheManager::DeleteCache(const char* path) cmsys::Directory dir; cmakeFiles += "/CMakeFiles"; 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:: FileIsDirectory(dir.GetFile(fileNum))) @@ -625,7 +643,7 @@ bool cmCacheManager::DeleteCache(const char* path) return true; } -void cmCacheManager::OutputHelpString(std::ofstream& fout, +void cmCacheManager::OutputHelpString(std::ofstream& fout, const std::string& helpString) { std::string::size_type end = helpString.size(); @@ -683,7 +701,8 @@ cmCacheManager::CacheEntry *cmCacheManager::GetCacheEntry(const char* key) return 0; } -cmCacheManager::CacheIterator cmCacheManager::GetCacheIterator(const char *key) +cmCacheManager::CacheIterator cmCacheManager::GetCacheIterator( + const char *key) { return CacheIterator(*this, key); } @@ -709,17 +728,19 @@ void cmCacheManager::PrintCache(std::ostream& out) const { 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 << "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; } -void cmCacheManager::AddCacheEntry(const char* key, - const char* value, +void cmCacheManager::AddCacheEntry(const char* key, + const char* value, const char* helpString, CacheEntryType type) { @@ -729,7 +750,7 @@ void cmCacheManager::AddCacheEntry(const char* key, e.m_Value = value; e.m_Initialized = true; } - else + else { e.m_Value = ""; } @@ -743,14 +764,15 @@ void cmCacheManager::AddCacheEntry(const char* key, { e.m_Properties["HELPSTRING"] = helpString; } - 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; } -void cmCacheManager::AddCacheEntry(const char* key, bool v, +void cmCacheManager::AddCacheEntry(const char* key, bool v, const char* helpString) { if(v) @@ -768,9 +790,9 @@ bool cmCacheManager::CacheIterator::IsAtEnd() const return m_Position == m_Container.m_Cache.end(); } -void cmCacheManager::CacheIterator::Begin() +void cmCacheManager::CacheIterator::Begin() { - m_Position = m_Container.m_Cache.begin(); + m_Position = m_Container.m_Cache.begin(); } bool cmCacheManager::CacheIterator::Find(const char* key) @@ -779,11 +801,11 @@ bool cmCacheManager::CacheIterator::Find(const char* key) return !this->IsAtEnd(); } -void cmCacheManager::CacheIterator::Next() +void cmCacheManager::CacheIterator::Next() { if (!this->IsAtEnd()) { - ++m_Position; + ++m_Position; } } @@ -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 if (this->IsAtEnd()) @@ -815,12 +838,12 @@ const char* cmCacheManager::CacheIterator::GetProperty(const char* property) con if ( !strcmp(property, "TYPE") || !strcmp(property, "VALUE") ) { - cmSystemTools::Error("Property \"", property, + cmSystemTools::Error("Property \"", property, "\" cannot be accessed through the GetProperty()"); return 0; } const CacheEntry* ent = &this->GetEntry(); - std::map<cmStdString,cmStdString>::const_iterator it = + std::map<cmStdString,cmStdString>::const_iterator it = ent->m_Properties.find(property); if ( it == ent->m_Properties.end() ) { @@ -829,7 +852,7 @@ const char* cmCacheManager::CacheIterator::GetProperty(const char* property) con return it->second.c_str(); } -void cmCacheManager::CacheIterator::SetProperty(const char* p, const char* v) +void cmCacheManager::CacheIterator::SetProperty(const char* p, const char* v) { // make sure it is not at the end if (this->IsAtEnd()) @@ -839,7 +862,7 @@ void cmCacheManager::CacheIterator::SetProperty(const char* p, const char* v) if ( !strcmp(p, "TYPE") || !strcmp(p, "VALUE") ) { - cmSystemTools::Error("Property \"", p, + cmSystemTools::Error("Property \"", p, "\" cannot be accessed through the SetProperty()"); return; } @@ -847,27 +870,28 @@ void cmCacheManager::CacheIterator::SetProperty(const char* p, const char* v) ent->m_Properties[p] = v; } -bool cmCacheManager::CacheIterator::GetValueAsBool() const -{ - return cmSystemTools::IsOn(this->GetEntry().m_Value.c_str()); +bool cmCacheManager::CacheIterator::GetValueAsBool() const +{ + 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 if (this->IsAtEnd()) { return false; } - + if ( !strcmp(property, "TYPE") || !strcmp(property, "VALUE") ) { - cmSystemTools::Error("Property \"", property, - "\" cannot be accessed through the GetPropertyAsBool()"); + cmSystemTools::Error("Property \"", property, + "\" cannot be accessed through the GetPropertyAsBool()"); return false; } const CacheEntry* ent = &this->GetEntry(); - std::map<cmStdString,cmStdString>::const_iterator it = + std::map<cmStdString,cmStdString>::const_iterator it = ent->m_Properties.find(property); if ( it == ent->m_Properties.end() ) { @@ -877,7 +901,7 @@ bool cmCacheManager::CacheIterator::GetPropertyAsBool(const char* property) cons } -void cmCacheManager::CacheIterator::SetProperty(const char* p, bool v) +void cmCacheManager::CacheIterator::SetProperty(const char* p, bool v) { // make sure it is not at the end if (this->IsAtEnd()) @@ -887,7 +911,7 @@ void cmCacheManager::CacheIterator::SetProperty(const char* p, bool v) if ( !strcmp(p, "TYPE") || !strcmp(p, "VALUE") ) { - cmSystemTools::Error("Property \"", p, + cmSystemTools::Error("Property \"", p, "\" cannot be accessed through the SetProperty()"); return; } @@ -905,12 +929,12 @@ bool cmCacheManager::CacheIterator::PropertyExists(const char* property) const if ( !strcmp(property, "TYPE") || !strcmp(property, "VALUE") ) { - cmSystemTools::Error("Property \"", property, - "\" cannot be accessed through the PropertyExists()"); + cmSystemTools::Error("Property \"", property, + "\" cannot be accessed through the PropertyExists()"); return false; } const CacheEntry* ent = &this->GetEntry(); - std::map<cmStdString,cmStdString>::const_iterator it = + std::map<cmStdString,cmStdString>::const_iterator it = ent->m_Properties.find(property); if ( it == ent->m_Properties.end() ) { diff --git a/Source/cmCommandArgumentParser.cxx b/Source/cmCommandArgumentParser.cxx index 758e884..f492cd1 100644 --- a/Source/cmCommandArgumentParser.cxx +++ b/Source/cmCommandArgumentParser.cxx @@ -1,7 +1,8 @@ /* A Bison parser, made by GNU Bison 1.875d. */ /* 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 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: - 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: - remove TABs @@ -153,7 +156,7 @@ static void cmCommandArgumentError(yyscan_t yyscanner, const char* message); #endif #ifdef _MSC_VER # 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 @@ -1171,7 +1174,6 @@ yyreduce: { yyval.str = yyGetParser->ExpandSpecialVariable(yyvsp[-2].str,yyvsp[-1].str); - //std::cerr << __LINE__ << " here: [" << $<str>1 << "] [" << $<str>2 << "] [" << $<str>3 << "]" << std::endl; } break; @@ -1179,7 +1181,6 @@ yyreduce: { yyval.str = yyGetParser->ExpandVariable(yyvsp[-1].str); - //std::cerr << __LINE__ << " here: [" << $<str>1 << "] [" << $<str>2 << "] [" << $<str>3 << "]" << std::endl; } break; diff --git a/Source/cmCommandArgumentParserHelper.h b/Source/cmCommandArgumentParserHelper.h index dcbe5ef..f366768 100644 --- a/Source/cmCommandArgumentParserHelper.h +++ b/Source/cmCommandArgumentParserHelper.h @@ -9,12 +9,12 @@ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#ifndef cmCommandArgumentParserHelper_h +#ifndef cmCommandArgumentParserHelper_h #define cmCommandArgumentParserHelper_h #include "cmStandardIncludes.h" @@ -22,7 +22,8 @@ #define YYSTYPE cmCommandArgumentParserHelper::ParserType #define YYSTYPE_IS_DECLARED #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 * \brief Helper class for parsing java source files @@ -45,9 +46,10 @@ public: int ParseString(const char* str, int verb); // For the lexer: - void AllocateParserType(cmCommandArgumentParserHelper::ParserType* pt, + void AllocateParserType(cmCommandArgumentParserHelper::ParserType* pt, 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); void Error(const char* str); diff --git a/Source/cmCommandArgumentParserTokens.h b/Source/cmCommandArgumentParserTokens.h index 60a861d..7428e56 100644 --- a/Source/cmCommandArgumentParserTokens.h +++ b/Source/cmCommandArgumentParserTokens.h @@ -1,7 +1,8 @@ /* A Bison parser, made by GNU Bison 1.875d. */ /* 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 it under the terms of the GNU General Public License as published by diff --git a/Source/cmCreateTestSourceList.cxx b/Source/cmCreateTestSourceList.cxx index 04b1dad..678e600 100644 --- a/Source/cmCreateTestSourceList.cxx +++ b/Source/cmCreateTestSourceList.cxx @@ -9,8 +9,8 @@ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ @@ -26,7 +26,7 @@ bool cmCreateTestSourceList::InitialPass(std::vector<std::string> const& args) return false; } - + std::vector<std::string>::const_iterator i = args.begin(); std::string extraInclude; std::string function; @@ -63,7 +63,7 @@ bool cmCreateTestSourceList::InitialPass(std::vector<std::string> const& args) } } i = tests.begin(); - + // Name of the source list const char* sourceList = i->c_str(); @@ -73,7 +73,8 @@ bool cmCreateTestSourceList::InitialPass(std::vector<std::string> const& args) // make sure they specified an extension 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; } std::string driver = m_Makefile->GetCurrentOutputDirectory(); @@ -81,18 +82,18 @@ bool cmCreateTestSourceList::InitialPass(std::vector<std::string> const& args) driver += *i; ++i; - std::string configFile = + std::string configFile = m_Makefile->GetRequiredDefinition("CMAKE_ROOT"); configFile += "/Templates/TestDriver.cxx.in"; // Create the test driver file - + std::vector<std::string>::const_iterator testsBegin = i; std::vector<std::string> tests_func_name; // The rest of the arguments consist of a list of test source files. - // Sadly, they can be in directories. Let's find a unique function + // Sadly, they can be in directories. Let's find a unique function // name for the corresponding test, and push it to the tests_func_name - // list. + // list. // For the moment: // - replace spaces ' ', ':' and '/' with underscores '_' std::string forwardDeclareCode; @@ -105,7 +106,7 @@ bool cmCreateTestSourceList::InitialPass(std::vector<std::string> const& args) std::string func_name; if (cmSystemTools::GetFilenamePath(*i).size() > 0) { - func_name = cmSystemTools::GetFilenamePath(*i) + "/" + + func_name = cmSystemTools::GetFilenamePath(*i) + "/" + cmSystemTools::GetFilenameWithoutLastExtension(*i); } else @@ -121,7 +122,7 @@ bool cmCreateTestSourceList::InitialPass(std::vector<std::string> const& args) forwardDeclareCode += func_name; forwardDeclareCode += "(int, char*[]);\n"; } - + std::string functionMapCode; int numTests = 0; std::vector<std::string>::iterator j; @@ -130,7 +131,7 @@ bool cmCreateTestSourceList::InitialPass(std::vector<std::string> const& args) std::string func_name; if (cmSystemTools::GetFilenamePath(*i).size() > 0) { - func_name = cmSystemTools::GetFilenamePath(*i) + "/" + + func_name = cmSystemTools::GetFilenamePath(*i) + "/" + cmSystemTools::GetFilenameWithoutLastExtension(*i); } else @@ -149,16 +150,21 @@ bool cmCreateTestSourceList::InitialPass(std::vector<std::string> const& args) } 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()) { - 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_FUNCTION_TABLE_ENTIRES", functionMapCode.c_str()); + m_Makefile->AddDefinition("CMAKE_FORWARD_DECLARE_TESTS", + forwardDeclareCode.c_str()); + m_Makefile->AddDefinition("CMAKE_FUNCTION_TABLE_ENTIRES", + functionMapCode.c_str()); 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; } @@ -166,22 +172,22 @@ bool cmCreateTestSourceList::InitialPass(std::vector<std::string> const& args) // Create the source list cmSourceFile cfile; std::string sourceListValue; - + cfile.SetProperty("ABSTRACT","0"); - cfile.SetName(cmSystemTools::GetFilenameWithoutExtension(args[1]).c_str(), + cfile.SetName(cmSystemTools::GetFilenameWithoutExtension(args[1]).c_str(), m_Makefile->GetCurrentOutputDirectory(), - cmSystemTools::GetFilenameExtension(args[1]).c_str()+1, + cmSystemTools::GetFilenameExtension(args[1]).c_str()+1, false); m_Makefile->AddSource(cfile); sourceListValue = args[1]; - + for(i = testsBegin; i != tests.end(); ++i) { cmSourceFile icfile; icfile.SetProperty("ABSTRACT","0"); - icfile.SetName(i->c_str(), + icfile.SetName(i->c_str(), m_Makefile->GetCurrentDirectory(), - m_Makefile->GetSourceExtensions(), + m_Makefile->GetSourceExtensions(), m_Makefile->GetHeaderExtensions()); m_Makefile->AddSource(icfile); sourceListValue += ";"; diff --git a/Source/cmCustomCommand.cxx b/Source/cmCustomCommand.cxx index ca52460..4278c7d 100644 --- a/Source/cmCustomCommand.cxx +++ b/Source/cmCustomCommand.cxx @@ -37,7 +37,8 @@ cmCustomCommand::cmCustomCommand(const cmCustomCommand& r): cmCustomCommand::cmCustomCommand(const char* output, const std::vector<std::string>& depends, const cmCustomCommandLines& commandLines, - const char* comment, const char* workingDirectory): + const char* comment, + const char* workingDirectory): m_Output(output?output:""), m_Depends(depends), m_CommandLines(commandLines), diff --git a/Source/cmDependsC.cxx b/Source/cmDependsC.cxx index 9a9c164..604e479 100644 --- a/Source/cmDependsC.cxx +++ b/Source/cmDependsC.cxx @@ -31,7 +31,7 @@ cmDependsC::cmDependsC(): // yummy look at all those constructor arguments cmDependsC::cmDependsC(std::vector<std::string> const& includes, const char* scanRegex, const char* complainRegex, - std::set<cmStdString> const& generatedFiles, + std::set<cmStdString> const& generatedFiles, const cmStdString& cacheFileName): m_IncludePath(&includes), m_IncludeRegexLine("^[ \t]*#[ \t]*include[ \t]*[<\"]([^\">]+)([\">])"), @@ -48,7 +48,8 @@ cmDependsC::~cmDependsC() { 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) { delete it->second; @@ -154,13 +155,14 @@ bool cmDependsC::WriteDependencies(const char *src, const char *obj, scanned.insert(fullName); // 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()) { fileIt->second->m_Used=true; dependencies.insert(fullName); for (std::vector<UnscannedEntry>::const_iterator incIt= - fileIt->second->m_UnscannedEntries.begin(); + fileIt->second->m_UnscannedEntries.begin(); incIt!=fileIt->second->m_UnscannedEntries.end(); ++incIt) { if (m_Encountered.find(incIt->FileName) == m_Encountered.end()) @@ -172,7 +174,7 @@ bool cmDependsC::WriteDependencies(const char *src, const char *obj, } else { - + // Try to scan the file. Just leave it out if we cannot find // it. std::ifstream fin(fullName.c_str()); @@ -180,7 +182,7 @@ bool cmDependsC::WriteDependencies(const char *src, const char *obj, { // Add this file as a dependency. dependencies.insert(fullName); - + // Scan this file for new dependencies. Pass the directory // containing the file to handle double-quote includes. std::string dir = cmSystemTools::GetFilenamePath(fullName); @@ -188,10 +190,10 @@ bool cmDependsC::WriteDependencies(const char *src, const char *obj, } } } - + first = false; } - + // Write the dependencies to the output stream. internalDepends << obj << std::endl; for(std::set<cmStdString>::iterator i=dependencies.begin(); @@ -203,7 +205,7 @@ bool cmDependsC::WriteDependencies(const char *src, const char *obj, internalDepends << " " << i->c_str() << std::endl; } makeDepends << std::endl; - + return true; } @@ -219,11 +221,11 @@ void cmDependsC::ReadCacheFile() { return; } - + std::string line; cmIncludeLines* cacheEntry=0; bool haveFileName=false; - + while(cmSystemTools::GetLineFromStream(fin, line)) { if (line.empty()) @@ -238,12 +240,13 @@ void cmDependsC::ReadCacheFile() haveFileName=true; int newer=0; 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 { cacheEntry=new cmIncludeLines; - m_fileCache[line]=cacheEntry; + m_fileCache[line]=cacheEntry; } } else if (cacheEntry!=0) @@ -274,16 +277,17 @@ void cmDependsC::WriteCacheFile() const { 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) { if (fileIt->second->m_Used) { cacheOut<<fileIt->first.c_str()<<std::endl; - + for (std::vector<UnscannedEntry>::const_iterator - incIt=fileIt->second->m_UnscannedEntries.begin(); + incIt=fileIt->second->m_UnscannedEntries.begin(); incIt!=fileIt->second->m_UnscannedEntries.end(); ++incIt) { cacheOut<<incIt->FileName.c_str()<<std::endl; @@ -302,12 +306,13 @@ 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; newCacheEntry->m_Used=true; m_fileCache[fullName]=newCacheEntry; - + // Read one line at a time. std::string line; while(cmSystemTools::GetLineFromStream(is, line)) diff --git a/Source/cmDependsC.h b/Source/cmDependsC.h index f7167e8..6c80db3 100644 --- a/Source/cmDependsC.h +++ b/Source/cmDependsC.h @@ -32,22 +32,24 @@ public: cmDependsC(); cmDependsC(std::vector<std::string> const& includes, 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 ~cmDependsC(); - + protected: typedef std::vector<char> t_CharBuffer; // Implement writing/checking methods required by superclass. - virtual bool WriteDependencies(const char *src, + virtual bool WriteDependencies(const char *src, const char *file, std::ostream& makeDepends, std::ostream& internalDepends); // 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. bool FileExistsOrIsGenerated(const std::string& fname, diff --git a/Source/cmDependsFortranLexer.cxx b/Source/cmDependsFortranLexer.cxx index 70ccfc2..1810806 100644 --- a/Source/cmDependsFortranLexer.cxx +++ b/Source/cmDependsFortranLexer.cxx @@ -43,7 +43,7 @@ typedef uint32_t flex_uint32_t; typedef signed char flex_int8_t; typedef short int flex_int16_t; typedef int flex_int32_t; -typedef unsigned char flex_uint8_t; +typedef unsigned char flex_uint8_t; typedef unsigned short int flex_uint16_t; typedef unsigned int flex_uint32_t; #endif /* ! C99 */ @@ -164,8 +164,9 @@ typedef struct yy_buffer_state *YY_BUFFER_STATE; #define EOB_ACT_LAST_MATCH 2 #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) \ do \ { \ @@ -174,7 +175,8 @@ typedef struct yy_buffer_state *YY_BUFFER_STATE; YY_LESS_LINENO(yyless_macro_arg);\ *yy_cp = yyg->yy_hold_char; \ 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 */ \ } \ while ( 0 ) @@ -231,7 +233,7 @@ struct yy_buffer_state int yy_bs_lineno; /**< The line count. */ int yy_bs_column; /**< The column count. */ - + /* Whether to try to fill the input buffer when we reach the * end of it. */ @@ -248,8 +250,8 @@ struct yy_buffer_state * possible backing-up. * * When we actually see the EOF, we change the status to "new" - * (via cmDependsFortran_yyrestart()), so that the user can continue scanning by - * just pointing yyin at a new input file. + * (via cmDependsFortran_yyrestart()), so that the user can continue + * scanning by just pointing yyin at a new input file. */ #define YY_BUFFER_EOF_PENDING 2 @@ -774,7 +776,7 @@ extern int cmDependsFortran_yywrap (yyscan_t yyscanner ); #endif static void yyunput (int c,char *buf_ptr ,yyscan_t yyscanner); - + #ifndef yytext_ptr static void yy_flex_strncpy (char *,yyconst char *,int ,yyscan_t yyscanner); #endif @@ -1722,7 +1724,7 @@ static void cmDependsFortran_yy_load_buffer_state (yyscan_t yyscanner) YY_BUFFER_STATE cmDependsFortran_yy_create_buffer (FILE * file, int size , yyscan_t yyscanner) { YY_BUFFER_STATE b; - + b = (YY_BUFFER_STATE) cmDependsFortran_yyalloc(sizeof( struct yy_buffer_state ) ,yyscanner ); if ( ! b ) YY_FATAL_ERROR( "out of dynamic memory in cmDependsFortran_yy_create_buffer()" ); @@ -1766,7 +1768,7 @@ static void cmDependsFortran_yy_load_buffer_state (yyscan_t yyscanner) #ifndef __cplusplus extern int isatty (int ); #endif /* __cplusplus */ - + /* Initializes or reinitializes a buffer. * This function is sometimes called more than once on the same buffer, * such as during a cmDependsFortran_yyrestart() or at EOF. @@ -1792,7 +1794,7 @@ extern int isatty (int ); } b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; - + errno = oerrno; } @@ -1896,9 +1898,9 @@ static void cmDependsFortran_yyensure_buffer_stack (yyscan_t yyscanner) yyg->yy_buffer_stack = (struct yy_buffer_state**)cmDependsFortran_yyalloc (num_to_alloc * sizeof(struct yy_buffer_state*) , yyscanner); - + memset(yyg->yy_buffer_stack, 0, num_to_alloc * sizeof(struct yy_buffer_state*)); - + yyg->yy_buffer_stack_max = num_to_alloc; yyg->yy_buffer_stack_top = 0; return; @@ -1925,12 +1927,12 @@ static void cmDependsFortran_yyensure_buffer_stack (yyscan_t yyscanner) * @param base the character buffer * @param size the size in bytes of the character buffer * @param yyscanner The scanner object. - * @return the newly allocated buffer state object. + * @return the newly allocated buffer state object. */ YY_BUFFER_STATE cmDependsFortran_yy_scan_buffer (char * base, yy_size_t size , yyscan_t yyscanner) { YY_BUFFER_STATE b; - + if ( size < 2 || base[size-2] != YY_END_OF_BUFFER_CHAR || base[size-1] != YY_END_OF_BUFFER_CHAR ) @@ -1966,7 +1968,7 @@ 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) { - + return cmDependsFortran_yy_scan_bytes(yy_str,strlen(yy_str) ,yyscanner); } @@ -1983,7 +1985,7 @@ YY_BUFFER_STATE cmDependsFortran_yy_scan_bytes (yyconst char * bytes, int len char *buf; yy_size_t n; int i; - + /* Get memory for full buffer, including space for trailing EOB's. */ n = len + 2; buf = (char *) cmDependsFortran_yyalloc(n ,yyscanner ); @@ -2051,10 +2053,10 @@ YY_EXTRA_TYPE cmDependsFortran_yyget_extra (yyscan_t yyscanner) int cmDependsFortran_yyget_lineno (yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; - + if (! YY_CURRENT_BUFFER) return 0; - + return yylineno; } @@ -2064,10 +2066,10 @@ int cmDependsFortran_yyget_lineno (yyscan_t yyscanner) int cmDependsFortran_yyget_column (yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; - + if (! YY_CURRENT_BUFFER) return 0; - + return yycolumn; } @@ -2128,8 +2130,8 @@ void cmDependsFortran_yyset_lineno (int line_number , yyscan_t yyscanner) /* lineno is only valid if an input buffer exists. */ if (! YY_CURRENT_BUFFER ) - yy_fatal_error( "cmDependsFortran_yyset_lineno called with no buffer" , yyscanner); - + yy_fatal_error( "cmDependsFortran_yyset_lineno called with no buffer" , yyscanner); + yylineno = line_number; } @@ -2143,8 +2145,8 @@ void cmDependsFortran_yyset_column (int column_no , yyscan_t yyscanner) /* column is only valid if an input buffer exists. */ if (! YY_CURRENT_BUFFER ) - yy_fatal_error( "cmDependsFortran_yyset_column called with no buffer" , yyscanner); - + yy_fatal_error( "cmDependsFortran_yyset_column called with no buffer" , yyscanner); + yycolumn = column_no; } diff --git a/Source/cmDependsFortranLexer.h b/Source/cmDependsFortranLexer.h index 94dff8f..b7c133b 100644 --- a/Source/cmDependsFortranLexer.h +++ b/Source/cmDependsFortranLexer.h @@ -43,7 +43,7 @@ typedef uint32_t flex_uint32_t; typedef signed char flex_int8_t; typedef short int flex_int16_t; typedef int flex_int32_t; -typedef unsigned char flex_uint8_t; +typedef unsigned char flex_uint8_t; typedef unsigned short int flex_uint16_t; typedef unsigned int flex_uint32_t; #endif /* ! C99 */ @@ -173,7 +173,7 @@ struct yy_buffer_state int yy_bs_lineno; /**< The line count. */ int yy_bs_column; /**< The column count. */ - + /* Whether to try to fill the input buffer when we reach the * end of it. */ @@ -185,16 +185,24 @@ struct yy_buffer_state #endif /* !YY_STRUCT_YY_BUFFER_STATE */ void cmDependsFortran_yyrestart (FILE *input_file ,yyscan_t yyscanner ); -void cmDependsFortran_yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner ); -YY_BUFFER_STATE cmDependsFortran_yy_create_buffer (FILE *file,int size ,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_yy_switch_to_buffer (YY_BUFFER_STATE new_buffer , + yyscan_t yyscanner ); +YY_BUFFER_STATE cmDependsFortran_yy_create_buffer (FILE *file,int size , + 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 ); -YY_BUFFER_STATE cmDependsFortran_yy_scan_buffer (char *base,yy_size_t size ,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 ); +YY_BUFFER_STATE cmDependsFortran_yy_scan_buffer (char *base,yy_size_t size , + 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_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 ); -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 ); @@ -294,7 +303,8 @@ extern int cmDependsFortran_yylex (yyscan_t yyscanner); #define YY_DECL int cmDependsFortran_yylex (yyscan_t yyscanner) #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_FLUSH_BUFFER diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx index 370e5e46..e6b5a59 100644 --- a/Source/cmLocalVisualStudio7Generator.cxx +++ b/Source/cmLocalVisualStudio7Generator.cxx @@ -9,8 +9,8 @@ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ @@ -48,7 +48,7 @@ void cmLocalVisualStudio7Generator::Generate() // for CommandLine= need to repleace quotes with " // write out configurations void cmLocalVisualStudio7Generator::OutputVCProjFile() -{ +{ // If not an in source build, then create the output directory if(strcmp(m_Makefile->GetStartOutputDirectory(), m_Makefile->GetHomeDirectory()) != 0) @@ -59,7 +59,7 @@ void cmLocalVisualStudio7Generator::OutputVCProjFile() m_Makefile->GetStartOutputDirectory()); } } - + m_LibraryOutputPath = ""; if (m_Makefile->GetDefinition("LIBRARY_OUTPUT_PATH")) { @@ -86,7 +86,7 @@ void cmLocalVisualStudio7Generator::OutputVCProjFile() m_ExecutableOutputPath += "/"; } } - + // Create the VCProj or set of VCProj's for libraries and executables // clear project names @@ -97,8 +97,8 @@ void cmLocalVisualStudio7Generator::OutputVCProjFile() // generators. It is duplicated in every generator. // Call TraceVSDependencies on all targets - cmTargets &tgts = m_Makefile->GetTargets(); - for(cmTargets::iterator l = tgts.begin(); + cmTargets &tgts = m_Makefile->GetTargets(); + for(cmTargets::iterator l = tgts.begin(); l != tgts.end(); l++) { // Add a rule to regenerate the build system when the target @@ -121,11 +121,11 @@ void cmLocalVisualStudio7Generator::OutputVCProjFile() target.TraceVSDependencies(target.GetName(), m_Makefile); } } - // now for all custom commands that are not used directly in a + // now for all custom commands that are not used directly in a // target, add them to all targets in the current directory or // makefile std::vector<cmSourceFile*> & classesmf = m_Makefile->GetSourceFiles(); - for(std::vector<cmSourceFile*>::const_iterator i = classesmf.begin(); + for(std::vector<cmSourceFile*>::const_iterator i = classesmf.begin(); i != classesmf.end(); i++) { if(cmCustomCommand* cc = (*i)->GetCustomCommand()) @@ -133,16 +133,16 @@ void cmLocalVisualStudio7Generator::OutputVCProjFile() // while we are at it, if it is a .rule file then for visual studio 7 we // must generate it so that depend information works correctly if ((*i)->GetSourceExtension() == "rule") - { + { std::string source = (*i)->GetFullPath(); if(!cmSystemTools::FileExists(source.c_str())) { cmSystemTools::ReplaceString(source, "$(IntDir)/", ""); #if defined(_WIN32) || defined(__CYGWIN__) - std::ofstream fout(source.c_str(), + std::ofstream fout(source.c_str(), std::ios::binary | std::ios::out | std::ios::trunc); #else - std::ofstream fout(source.c_str(), + std::ofstream fout(source.c_str(), std::ios::out | std::ios::trunc); #endif if(fout) @@ -155,7 +155,7 @@ void cmLocalVisualStudio7Generator::OutputVCProjFile() } if(!cc->IsUsed()) { - for(cmTargets::iterator l = tgts.begin(); + for(cmTargets::iterator l = tgts.begin(); l != tgts.end(); l++) { if ((l->second.GetType() != cmTarget::INSTALL_FILES) @@ -185,7 +185,7 @@ void cmLocalVisualStudio7Generator::OutputVCProjFile() } } #endif - for(cmTargets::iterator l = tgts.begin(); + for(cmTargets::iterator l = tgts.begin(); l != tgts.end(); l++) { // INCLUDE_EXTERNAL_MSPROJECT command only affects the workspace @@ -241,12 +241,12 @@ void cmLocalVisualStudio7Generator::AddVCProjBuildRule(cmTarget& tgt) this->Convert(m_Makefile->GetHomeDirectory(), START_OUTPUT, SHELL, true); commandLine.push_back(args); args = "-B"; - args += - this->Convert(m_Makefile->GetHomeOutputDirectory(), + args += + this->Convert(m_Makefile->GetHomeOutputDirectory(), START_OUTPUT, SHELL, true); commandLine.push_back(args); - - std::string configFile = + + std::string configFile = m_Makefile->GetRequiredDefinition("CMAKE_ROOT"); configFile += "/Templates/CMakeWindowsSystemConfig.cmake"; std::vector<std::string> listFiles = m_Makefile->GetListFiles(); @@ -281,11 +281,11 @@ void cmLocalVisualStudio7Generator::AddVCProjBuildRule(cmTarget& tgt) } -void cmLocalVisualStudio7Generator::WriteConfigurations(std::ostream& fout, +void cmLocalVisualStudio7Generator::WriteConfigurations(std::ostream& fout, const char *libName, cmTarget &target) { - std::vector<std::string> *configs = + std::vector<std::string> *configs = static_cast<cmGlobalVisualStudio7Generator *>(m_GlobalGenerator)->GetConfigurations(); fout << "\t<Configurations>\n"; for( std::vector<std::string>::iterator i = configs->begin(); @@ -310,7 +310,7 @@ struct cmVS7FlagTable // NOTE: Make sure the longer commandFlag comes FIRST! cmVS7FlagTable cmLocalVisualStudio7GeneratorFlagTable[] = { - // option flags (some flags map to the same option) + // option flags (some flags map to the same option) {"BasicRuntimeChecks", "GZ", "Stack frame checks", "1"}, {"BasicRuntimeChecks", "RTCsu", "Both stack and uninitialized checks ", "3"}, {"BasicRuntimeChecks", "RTCs", "Stack frame checks", "1"}, @@ -351,7 +351,7 @@ cmVS7FlagTable cmLocalVisualStudio7GeneratorFlagTable[] = {"WarningLevel", "W3", "Warning level", "3"}, {"WarningLevel", "W4", "Warning level", "4"}, - // boolean flags + // boolean flags {"BufferSecurityCheck", "GS", "Buffer security check", "TRUE"}, {"EnableFibreSafeOptimization", "GT", "OmitFramePointers", "TRUE"}, {"EnableFunctionLevelLinking", "Gy", "EnableFunctionLevelLinking", "TRUE"}, @@ -373,24 +373,24 @@ cmVS7FlagTable cmLocalVisualStudio7GeneratorFlagTable[] = cmVS7FlagTable cmLocalVisualStudio7GeneratorLinkFlagTable[] = { - // option flags (some flags map to the same option) + // option flags (some flags map to the same option) {"LinkIncremental", "INCREMENTAL:NO", "link incremental", "1"}, {"LinkIncremental", "INCREMENTAL:YES", "link incremental", "2"}, {0,0,0,0 } }; - - - -void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout, + + + +void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout, const char* configName, const char *libName, cmTarget &target) -{ +{ // create a map of xml tags to the values they should have in the output // for example, "BufferSecurityCheck" = "TRUE" // first fill this table with the values for the configuration @@ -415,10 +415,10 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout, // 4 == static library // 2 == dll // 1 == executable - // 10 == utility + // 10 == utility const char* configType = "10"; switch(target.GetType()) - { + { case cmTarget::STATIC_LIBRARY: configType = "4"; break; @@ -426,16 +426,16 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout, case cmTarget::MODULE_LIBRARY: configType = "2"; break; - case cmTarget::EXECUTABLE: + case cmTarget::EXECUTABLE: configType = "1"; - break; + break; case cmTarget::UTILITY: case cmTarget::GLOBAL_TARGET: configType = "10"; default: break; } - + std::string flags; if(strcmp(configType, "10") != 0) { @@ -447,7 +447,7 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout, return; } if(!(strcmp(linkLanguage, "RC") == 0 || strcmp(linkLanguage, "DEF") == 0)) - { + { std::string baseFlagVar = "CMAKE_"; baseFlagVar += linkLanguage; baseFlagVar += "_FLAGS"; @@ -458,7 +458,7 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout, flags += m_Makefile->GetRequiredDefinition(flagVar.c_str()); } } - + // Add the target-specific flags. if(const char* targetFlags = target.GetProperty("COMPILE_FLAGS")) { @@ -479,7 +479,7 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout, << "\t\t\tATLMinimizesCRunTimeLibraryUsage=\"FALSE\"\n"; // if -D_UNICODE or /D_UNICODE is found in the flags // change the character set to unicode, if not then - // default to MBCS + // default to MBCS std::string defs = m_Makefile->GetDefineFlags(); if(flags.find("D_UNICODE") != flags.npos || defs.find("D_UNICODE") != flags.npos) @@ -490,26 +490,26 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout, { fout << "\t\t\tCharacterSet=\"2\">\n"; } - + fout << "\t\t\t<Tool\n" << "\t\t\t\tName=\"VCCLCompilerTool\"\n" << "\t\t\t\tAdditionalOptions=\""; // now fill the flagMap from the command line flags, and // if a flag is used, it will be removed from the flags string by // this function call - this->FillFlagMapFromCommandFlags(flagMap, + this->FillFlagMapFromCommandFlags(flagMap, &cmLocalVisualStudio7GeneratorFlagTable[0], flags); std::string defineFlags = m_Makefile->GetDefineFlags(); // now check the define flags for flags other than -D and // put them in the map, the -D flags will be left in the defineFlags // variable as -D is not in the flagMap - this->FillFlagMapFromCommandFlags(flagMap, + this->FillFlagMapFromCommandFlags(flagMap, &cmLocalVisualStudio7GeneratorFlagTable[0], - defineFlags); + defineFlags); // output remaining flags that were not mapped to anything fout << this->EscapeForXML(flags.c_str()).c_str(); - fout << " -DCMAKE_INTDIR=\\"" << configName << "\\"" + fout << " -DCMAKE_INTDIR=\\"" << configName << "\\"" << "\"\n"; fout << "\t\t\t\tAdditionalIncludeDirectories=\""; std::vector<std::string> includes; @@ -560,9 +560,9 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout, fout << "\t\t\t\tObjectFile=\"$(IntDir)\\\"\n"; std::map<cmStdString, cmStdString>::iterator mi = flagMap.find("DebugInformationFormat"); if(mi != flagMap.end() && mi->second != "1") - { + { fout << "\t\t\t\tProgramDatabaseFileName=\"" - << m_LibraryOutputPath + << m_LibraryOutputPath << "$(OutDir)/" << libName << ".pdb\"\n"; } fout << "/>\n"; // end of <Tool Name=VCCLCompilerTool @@ -574,7 +574,7 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout, std::string ipath = this->ConvertToXMLOutputPath(i->c_str()); fout << ipath << ";"; } - // add the -D flags to the RC tool + // add the -D flags to the RC tool fout << "\"\n" << "\t\t\t\tPreprocessorDefinitions=\""; this->OutputDefineFlags(defineFlags.c_str(), fout); @@ -615,7 +615,7 @@ void cmLocalVisualStudio7Generator::FillFlagMapFromCommandFlags( option += flagTable->commandFlag; while(flags.find(option) != flags.npos) { - // replace the flag + // replace the flag cmSystemTools::ReplaceString(flags, option.c_str(), ""); // now put value into flag map flagMap[flagTable->IDEName] = flagTable->value; @@ -624,7 +624,7 @@ void cmLocalVisualStudio7Generator::FillFlagMapFromCommandFlags( option[0] = '/'; while(flags.find(option) != flags.npos) { - // replace the flag + // replace the flag cmSystemTools::ReplaceString(flags, option.c_str(), ""); // now put value into flag map flagMap[flagTable->IDEName] = flagTable->value; @@ -683,7 +683,7 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout, extraLinkOptions = m_Makefile->GetRequiredDefinition("CMAKE_MODULE_LINKER_FLAGS") + std::string(" ") + GetBuildTypeLinkerFlags("CMAKE_MODULE_LINKER_FLAGS", configName); } - + const char* targetLinkFlags = target.GetProperty("LINK_FLAGS"); if(targetLinkFlags) { @@ -693,7 +693,7 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout, std::map<cmStdString, cmStdString> flagMap; this-> - FillFlagMapFromCommandFlags(flagMap, + FillFlagMapFromCommandFlags(flagMap, &cmLocalVisualStudio7GeneratorLinkFlagTable[0], extraLinkOptions); switch(target.GetType()) @@ -708,7 +708,7 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout, { fout << "\t\t\t\tAdditionalOptions=\"" << libflags << "\"\n"; } - fout << "\t\t\t\tOutputFile=\"" + fout << "\t\t\t\tOutputFile=\"" << this->ConvertToXMLOutputPathSingle(libpath.c_str()) << ".\"/>\n"; break; } @@ -732,7 +732,7 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout, // libraries which may be set by the user to something bad. fout << "\"\n" << "\t\t\t\tAdditionalDependencies=\"$(NOINHERIT) " - << m_Makefile->GetRequiredDefinition("CMAKE_STANDARD_LIBRARIES") + << m_Makefile->GetRequiredDefinition("CMAKE_STANDARD_LIBRARIES") << " "; this->OutputLibraries(fout, linkLibs); fout << "\"\n"; @@ -740,7 +740,7 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout, temp += configName; temp += "/"; temp += targetFullName; - fout << "\t\t\t\tOutputFile=\"" + fout << "\t\t\t\tOutputFile=\"" << this->ConvertToXMLOutputPathSingle(temp.c_str()) << "\"\n"; for(std::map<cmStdString, cmStdString>::iterator i = flagMap.begin(); i != flagMap.end(); ++i) @@ -755,7 +755,7 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout, temp += "$(OutDir)/"; temp += libName; temp += ".pdb"; - fout << "\t\t\t\tProgramDatabaseFile=\"" << + fout << "\t\t\t\tProgramDatabaseFile=\"" << this->ConvertToXMLOutputPathSingle(temp.c_str()) << "\"\n"; if(strcmp(configName, "Debug") == 0 || strcmp(configName, "RelWithDebInfo") == 0) @@ -794,7 +794,7 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout, fout << "\t\t\t<Tool\n" << "\t\t\t\tName=\"VCLinkerTool\"\n" - << "\t\t\t\tAdditionalOptions=\"/MACHINE:I386"; + << "\t\t\t\tAdditionalOptions=\"/MACHINE:I386"; if(extraLinkOptions.size()) { fout << " " << cmLocalVisualStudio7Generator::EscapeForXML( @@ -804,7 +804,7 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout, // libraries which may be set by the user to something bad. fout << "\"\n" << "\t\t\t\tAdditionalDependencies=\"$(NOINHERIT) " - << m_Makefile->GetRequiredDefinition("CMAKE_STANDARD_LIBRARIES") + << m_Makefile->GetRequiredDefinition("CMAKE_STANDARD_LIBRARIES") << " "; this->OutputLibraries(fout, linkLibs); fout << "\"\n"; @@ -821,9 +821,9 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout, fout << "\t\t\t\tAdditionalLibraryDirectories=\""; this->OutputLibraryDirectories(fout, linkDirs); fout << "\"\n"; - fout << "\t\t\t\tProgramDatabaseFile=\"" << m_LibraryOutputPath + fout << "\t\t\t\tProgramDatabaseFile=\"" << m_LibraryOutputPath << "$(OutDir)\\" << libName << ".pdb\"\n"; - if(strcmp(configName, "Debug") == 0 + if(strcmp(configName, "Debug") == 0 || strcmp(configName, "RelWithDebInfo") == 0) { fout << "\t\t\t\tGenerateDebugInformation=\"TRUE\"\n"; @@ -833,10 +833,10 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout, fout << "\t\t\t\tSubSystem=\"2\"\n"; } else - { + { fout << "\t\t\t\tSubSystem=\"1\"\n"; - } - const char* linkLanguage = target.GetLinkerLanguage(this->GetGlobalGenerator()); + } + const char* linkLanguage = target.GetLinkerLanguage(this->GetGlobalGenerator()); if(!linkLanguage) { cmSystemTools::Error("CMake can not determine linker language for target:", @@ -864,9 +864,9 @@ void cmLocalVisualStudio7Generator::OutputModuleDefinitionFile(std::ostream& fou cmTarget &target) { std::vector<cmSourceFile*> const& classes = target.GetSourceFiles(); - for(std::vector<cmSourceFile*>::const_iterator i = classes.begin(); + for(std::vector<cmSourceFile*>::const_iterator i = classes.begin(); i != classes.end(); i++) - { + { if(cmSystemTools::UpperCase((*i)->GetSourceExtension()) == "DEF") { fout << "\t\t\t\tModuleDefinitionFile=\"" @@ -875,7 +875,7 @@ void cmLocalVisualStudio7Generator::OutputModuleDefinitionFile(std::ostream& fou return; } } - + } //---------------------------------------------------------------------------- @@ -951,29 +951,29 @@ void cmLocalVisualStudio7Generator::OutputDefineFlags(const char* flags, { pos = defs.find("-D", nextpos); } - } + } } -void cmLocalVisualStudio7Generator::WriteVCProjFile(std::ostream& fout, +void cmLocalVisualStudio7Generator::WriteVCProjFile(std::ostream& fout, const char *libName, cmTarget &target) { // get the configurations - std::vector<std::string> *configs = + std::vector<std::string> *configs = static_cast<cmGlobalVisualStudio7Generator *> (m_GlobalGenerator)->GetConfigurations(); - + // trace the visual studio dependencies std::string name = libName; name += ".vcproj.cmake"; // We may be modifying the source groups temporarily, so make a copy. std::vector<cmSourceGroup> sourceGroups = m_Makefile->GetSourceGroups(); - + // get the classes from the source lists then add them to the groups std::vector<cmSourceFile*> & classes = target.GetSourceFiles(); - for(std::vector<cmSourceFile*>::const_iterator i = classes.begin(); + for(std::vector<cmSourceFile*>::const_iterator i = classes.begin(); i != classes.end(); i++) { // Add the file to the list of sources. @@ -982,11 +982,11 @@ void cmLocalVisualStudio7Generator::WriteVCProjFile(std::ostream& fout, { m_ModuleDefinitionFile = (*i)->GetFullPath(); } - cmSourceGroup& sourceGroup = + cmSourceGroup& sourceGroup = m_Makefile->FindSourceGroup(source.c_str(), sourceGroups); sourceGroup.AssignSource(*i); } - + // open the project this->WriteProjectStart(fout, libName, target, sourceGroups); // write the configuration information @@ -1003,7 +1003,7 @@ void cmLocalVisualStudio7Generator::WriteVCProjFile(std::ostream& fout, } //} - + fout << "\t</Files>\n"; // Write the VCProj file's footer. @@ -1012,21 +1012,21 @@ void cmLocalVisualStudio7Generator::WriteVCProjFile(std::ostream& fout, void cmLocalVisualStudio7Generator::WriteGroup(const cmSourceGroup *sg, cmTarget target, std::ostream &fout, const char *libName, std::vector<std::string> *configs) { - const std::vector<const cmSourceFile *> &sourceFiles = + const std::vector<const cmSourceFile *> &sourceFiles = sg->GetSourceFiles(); // If the group is empty, don't write it at all. if(sourceFiles.empty() && sg->GetGroupChildren().empty()) - { - return; + { + return; } - + // If the group has a name, write the header. std::string name = sg->GetName(); if(name != "") { this->WriteVCProjBeginGroup(fout, name.c_str(), ""); } - + // Loop through each source in the source group. for(std::vector<const cmSourceFile *>::const_iterator sf = sourceFiles.begin(); sf != sourceFiles.end(); ++sf) @@ -1042,8 +1042,8 @@ void cmLocalVisualStudio7Generator::WriteGroup(const cmSourceGroup *sg, cmTarget { compileFlags += " "; compileFlags += cflags; - } - const char* lang = + } + const char* lang = m_GlobalGenerator->GetLanguageFromExtension((*sf)->GetSourceExtension().c_str()); if(lang && strcmp(lang, "CXX") == 0) { @@ -1104,7 +1104,7 @@ void cmLocalVisualStudio7Generator::WriteGroup(const cmSourceGroup *sg, cmTarget { aCompilerTool = "VCCustomBuildTool"; } - for(std::vector<std::string>::iterator i = configs->begin(); + for(std::vector<std::string>::iterator i = configs->begin(); i != configs->end(); ++i) { fout << "\t\t\t\t<FileConfiguration\n" @@ -1128,20 +1128,20 @@ void cmLocalVisualStudio7Generator::WriteGroup(const cmSourceGroup *sg, cmTarget fout << "\t\t\t</File>\n"; } } - + std::vector<cmSourceGroup> children = sg->GetGroupChildren(); for(unsigned int i=0;i<children.size();++i) { this->WriteGroup(&children[i], target, fout, libName, configs); } - + // If the group has a name, write the footer. if(name != "") { this->WriteVCProjEndGroup(fout); } -} +} void cmLocalVisualStudio7Generator:: WriteCustomRule(std::ostream& fout, @@ -1153,7 +1153,7 @@ WriteCustomRule(std::ostream& fout, const char* compileFlags) { std::vector<std::string>::iterator i; - std::vector<std::string> *configs = + std::vector<std::string> *configs = static_cast<cmGlobalVisualStudio7Generator *>(m_GlobalGenerator)->GetConfigurations(); for(i = configs->begin(); i != configs->end(); ++i) { @@ -1190,7 +1190,7 @@ WriteCustomRule(std::ostream& fout, { fout << source << "_force"; } - + // Write a rule for the output generated by this command. fout << this->ConvertToXMLOutputPathSingle(output); fout << "\"/>\n"; @@ -1199,7 +1199,7 @@ WriteCustomRule(std::ostream& fout, } -void cmLocalVisualStudio7Generator::WriteVCProjBeginGroup(std::ostream& fout, +void cmLocalVisualStudio7Generator::WriteVCProjBeginGroup(std::ostream& fout, const char* group, const char* ) { @@ -1217,19 +1217,19 @@ void cmLocalVisualStudio7Generator::WriteVCProjEndGroup(std::ostream& fout) // look for custom rules on a target and collect them together void cmLocalVisualStudio7Generator::OutputTargetRules(std::ostream& fout, - cmTarget &target, + cmTarget &target, const char * /*libName*/) { if (target.GetType() > cmTarget::GLOBAL_TARGET) { return; } - + // add the pre build rules fout << "\t\t\t<Tool\n\t\t\t\tName=\"VCPreBuildEventTool\""; bool init = false; - for (std::vector<cmCustomCommand>::const_iterator cr = - target.GetPreBuildCommands().begin(); + for (std::vector<cmCustomCommand>::const_iterator cr = + target.GetPreBuildCommands().begin(); cr != target.GetPreBuildCommands().end(); ++cr) { if(!init) @@ -1249,8 +1249,8 @@ void cmLocalVisualStudio7Generator::OutputTargetRules(std::ostream& fout, // add the pre Link rules fout << "\t\t\t<Tool\n\t\t\t\tName=\"VCPreLinkEventTool\""; init = false; - for (std::vector<cmCustomCommand>::const_iterator cr = - target.GetPreLinkCommands().begin(); + for (std::vector<cmCustomCommand>::const_iterator cr = + target.GetPreLinkCommands().begin(); cr != target.GetPreLinkCommands().end(); ++cr) { if(!init) @@ -1267,12 +1267,12 @@ void cmLocalVisualStudio7Generator::OutputTargetRules(std::ostream& fout, fout << "\""; } fout << "/>\n"; - + // add the PostBuild rules fout << "\t\t\t<Tool\n\t\t\t\tName=\"VCPostBuildEventTool\""; init = false; - for (std::vector<cmCustomCommand>::const_iterator cr = - target.GetPostBuildCommands().begin(); + for (std::vector<cmCustomCommand>::const_iterator cr = + target.GetPostBuildCommands().begin(); cr != target.GetPostBuildCommands().end(); ++cr) { if(!init) @@ -1290,10 +1290,10 @@ void cmLocalVisualStudio7Generator::OutputTargetRules(std::ostream& fout, fout << "/>\n"; } -void -cmLocalVisualStudio7Generator::WriteProjectStart(std::ostream& fout, +void +cmLocalVisualStudio7Generator::WriteProjectStart(std::ostream& fout, const char *libName, - cmTarget & target, + cmTarget & target, std::vector<cmSourceGroup> &) { fout << "<?xml version=\"1.0\" encoding = \"Windows-1252\"?>\n" @@ -1303,7 +1303,7 @@ cmLocalVisualStudio7Generator::WriteProjectStart(std::ostream& fout, { fout << "\tVersion=\"7.10\"\n"; } - else + else { if (m_Version == 8) { @@ -1384,7 +1384,7 @@ void cmLocalVisualStudio7Generator::ConfigureFinalPass() cmLocalGenerator::ConfigureFinalPass(); cmTargets &tgts = m_Makefile->GetTargets(); - cmGlobalVisualStudio7Generator* gg = + cmGlobalVisualStudio7Generator* gg = static_cast<cmGlobalVisualStudio7Generator *>(m_GlobalGenerator); for(cmTargets::iterator l = tgts.begin(); l != tgts.end(); l++) { @@ -1397,10 +1397,10 @@ void cmLocalVisualStudio7Generator::ConfigureFinalPass() } else { - gg->CreateGUID(l->first.c_str()); + gg->CreateGUID(l->first.c_str()); } } - + } //---------------------------------------------------------------------------- diff --git a/Source/cmMacroCommand.cxx b/Source/cmMacroCommand.cxx index ee5100d..eed8e4b 100644 --- a/Source/cmMacroCommand.cxx +++ b/Source/cmMacroCommand.cxx @@ -9,8 +9,8 @@ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ @@ -23,14 +23,14 @@ class cmMacroHelperCommand : public cmCommand { public: cmMacroHelperCommand() {} - + ///! clean up any memory allocated by the macro ~cmMacroHelperCommand() {}; - + /** * This is a virtual constructor for the command. */ - virtual cmCommand* Clone() + virtual cmCommand* Clone() { cmMacroHelperCommand *newC = new cmMacroHelperCommand; // we must copy when we clone @@ -38,7 +38,7 @@ public: newC->m_Functions = this->m_Functions; return newC; } - + /** * This determines if the command is invoked when in script mode. */ @@ -51,22 +51,22 @@ public: virtual bool InvokeInitialPass(const std::vector<cmListFileArgument>& args); virtual bool InitialPass(std::vector<std::string> const&) { return false; }; - + /** * The name of the command as specified in CMakeList.txt. */ virtual const char* GetName() { return this->m_Args[0].c_str(); } - + /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() { std::string docs = "Macro named: "; docs += this->GetName(); return docs.c_str(); } - + /** * More documentation. */ @@ -74,7 +74,7 @@ public: { return this->GetTerseDocumentation(); } - + cmTypeMacro(cmMacroHelperCommand, cmCommand); std::vector<std::string> m_Args; @@ -88,7 +88,7 @@ bool cmMacroHelperCommand::InvokeInitialPass // Expand the argument list to the macro. std::vector<std::string> expandedArgs; m_Makefile->ExpandArguments(args, expandedArgs); - + std::string tmps; cmListFileArgument arg; std::string variable; @@ -97,24 +97,24 @@ bool cmMacroHelperCommand::InvokeInitialPass // required by the signature if (expandedArgs.size() < m_Args.size() - 1) { - std::string errorMsg = + std::string errorMsg = "Macro invoked with incorrect arguments for macro named: "; errorMsg += m_Args[0]; this->SetError(errorMsg.c_str()); return false; } - + // set the value of argc cmOStringStream argcDefStream; argcDefStream << expandedArgs.size(); std::string argcDef = argcDefStream.str(); - + // declare varuiables for ARGV ARGN but do not compute until needed std::string argvDef; std::string argnDef; bool argnDefInitialized = false; bool argvDefInitialized = false; - + // Invoke all the functions that were collected in the block. cmListFileFunction newLFF; // for each function @@ -127,15 +127,15 @@ bool cmMacroHelperCommand::InvokeInitialPass newLFF.m_FilePath = m_Functions[c].m_FilePath; newLFF.m_Line = m_Functions[c].m_Line; const char* def = - m_Makefile->GetDefinition("CMAKE_MACRO_REPORT_DEFINITION_LOCATION"); + m_Makefile->GetDefinition("CMAKE_MACRO_REPORT_DEFINITION_LOCATION"); bool macroReportLocation = false; if(def && !cmSystemTools::IsOff(def)) { macroReportLocation = true; } - + // for each argument of the current function - for (std::vector<cmListFileArgument>::const_iterator k = + for (std::vector<cmListFileArgument>::const_iterator k = m_Functions[c].m_Arguments.begin(); k != m_Functions[c].m_Arguments.end(); ++k) { @@ -145,13 +145,13 @@ bool cmMacroHelperCommand::InvokeInitialPass { variable = "${"; variable += m_Args[j]; - variable += "}"; + variable += "}"; cmSystemTools::ReplaceString(tmps, variable.c_str(), expandedArgs[j-1].c_str()); } // replace argc cmSystemTools::ReplaceString(tmps, "${ARGC}",argcDef.c_str()); - + // repleace ARGN if (tmps.find("${ARGN}") != std::string::npos) { @@ -175,13 +175,13 @@ bool cmMacroHelperCommand::InvokeInitialPass } cmSystemTools::ReplaceString(tmps, "${ARGN}", argnDef.c_str()); } - + // if the current argument of the current function has ${ARGV in it // then try replacing ARGV values if (tmps.find("${ARGV") != std::string::npos) { char argvName[60]; - + // repleace ARGV, compute it only once if (!argvDefInitialized) { @@ -197,7 +197,7 @@ bool cmMacroHelperCommand::InvokeInitialPass argvDefInitialized = true; } cmSystemTools::ReplaceString(tmps, "${ARGV}", argvDef.c_str()); - + // also replace the ARGV1 ARGV2 ... etc for (unsigned int t = 0; t < expandedArgs.size(); ++t) { @@ -206,7 +206,7 @@ bool cmMacroHelperCommand::InvokeInitialPass expandedArgs[t].c_str()); } } - + arg.Value = tmps; arg.Quoted = k->Quoted; if(macroReportLocation) @@ -248,7 +248,7 @@ bool cmMacroHelperCommand::InvokeInitialPass } bool cmMacroFunctionBlocker:: -IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile &mf) +IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile &mf) { // record commands until we hit the ENDMACRO // at the ENDMACRO call we shift gears and start looking for invocations @@ -267,30 +267,31 @@ IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile &mf) } name += " )"; mf.AddMacro(m_Args[0].c_str(), name.c_str()); - + // create a new command and add it to cmake cmMacroHelperCommand *f = new cmMacroHelperCommand(); f->m_Args = this->m_Args; f->m_Functions = this->m_Functions; 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); - + // remove the function blocker now that the macro is defined mf.RemoveFunctionBlocker(lff); return true; } } - + // if it wasn't an endmacro and we are not executing then we must be // recording m_Functions.push_back(lff); return true; } - + bool cmMacroFunctionBlocker:: -ShouldRemove(const cmListFileFunction& lff, cmMakefile &mf) +ShouldRemove(const cmListFileFunction& lff, cmMakefile &mf) { if(cmSystemTools::LowerCase(lff.m_Name) == "endmacro") { @@ -305,12 +306,14 @@ ShouldRemove(const cmListFileFunction& lff, cmMakefile &mf) } void cmMacroFunctionBlocker:: -ScopeEnded(cmMakefile &mf) +ScopeEnded(cmMakefile &mf) { - // 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: ", - mf.GetCurrentDirectory(), " with macro ", - m_Args[0].c_str()); + // 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: ", + mf.GetCurrentDirectory(), " with macro ", + m_Args[0].c_str()); } bool cmMacroCommand::InitialPass(std::vector<std::string> const& args) @@ -320,16 +323,16 @@ bool cmMacroCommand::InitialPass(std::vector<std::string> const& args) this->SetError("called with incorrect number of arguments"); return false; } - + // create a function blocker cmMacroFunctionBlocker *f = new cmMacroFunctionBlocker(); for(std::vector<std::string>::const_iterator j = args.begin(); j != args.end(); ++j) - { + { f->m_Args.push_back(*j); } m_Makefile->AddFunctionBlocker(f); - + return true; } diff --git a/Source/cmMacroCommand.h b/Source/cmMacroCommand.h index c7a4d3e..44e192b 100644 --- a/Source/cmMacroCommand.h +++ b/Source/cmMacroCommand.h @@ -9,8 +9,8 @@ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ @@ -23,7 +23,7 @@ /** \class cmMacroFunctionBlocker * \brief subclass of function blocker * - * + * */ class cmMacroFunctionBlocker : public cmFunctionBlocker { @@ -33,7 +33,7 @@ public: virtual bool IsFunctionBlocked(const cmListFileFunction&, cmMakefile &mf); virtual bool ShouldRemove(const cmListFileFunction&, cmMakefile &mf); virtual void ScopeEnded(cmMakefile &mf); - + std::vector<std::string> m_Args; std::vector<cmListFileFunction> m_Functions; }; @@ -49,7 +49,7 @@ public: /** * This is a virtual constructor for the command. */ - virtual cmCommand* Clone() + virtual cmCommand* Clone() { return new cmMacroCommand; } @@ -73,11 +73,11 @@ public: /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() { return "Start recording a macro for later invocation as a command."; } - + /** * More documentation. */ @@ -93,8 +93,8 @@ public: "arg1 arg2 arg3 (...). Commands listed after MACRO, " "but before the matching ENDMACRO, are not invoked until the macro " "is invoked. When it is invoked, the commands recorded in the " - "macro are first modified by replacing formal parameters (${arg1}) with " - "the arguments passed, and then invoked as normal commands. In " + "macro are first modified by replacing formal parameters (${arg1}) " + "with the arguments passed, and then invoked as normal commands. In " "addition to referencing the formal parameters you can reference " "the variable ARGC which will be set to the number of arguments " "passed into the function as well as ARGV0 ARGV1 ARGV2 ... which " @@ -103,7 +103,7 @@ public: "ARGV holds the list of all arguments given to the macro and ARGN " "holds the list of argument pass the last expected argument."; } - + cmTypeMacro(cmMacroCommand, cmCommand); }; diff --git a/Source/cmMakeDepend.cxx b/Source/cmMakeDepend.cxx index 02795eb..3d32991 100644 --- a/Source/cmMakeDepend.cxx +++ b/Source/cmMakeDepend.cxx @@ -9,8 +9,8 @@ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ @@ -36,7 +36,7 @@ cmMakeDepend::cmMakeDepend() cmMakeDepend::~cmMakeDepend() -{ +{ for(DependInformationMap::iterator i = m_DependInformationMap.begin(); i != m_DependInformationMap.end(); ++i) { @@ -58,7 +58,7 @@ void cmMakeDepend::SetMakefile(cmMakefile* makefile) m_Makefile->m_IncludeFileRegularExpression.c_str()); m_ComplainFileRegularExpression.compile( m_Makefile->m_ComplainFileRegularExpression.c_str()); - + // Now extract any include paths from the makefile flags const std::vector<std::string>& includes = m_Makefile->GetIncludeDirectories(); @@ -94,7 +94,8 @@ void cmMakeDepend::GenerateDependInformation(cmDependInformation* info) const char* path = info->m_FullPath.c_str(); if(!path) { - cmSystemTools::Error("Attempt to find dependencies for file without path!"); + cmSystemTools::Error( + "Attempt to find dependencies for file without path!"); return; } @@ -108,7 +109,7 @@ void cmMakeDepend::GenerateDependInformation(cmDependInformation* info) found = true; } - + // See if the cmSourceFile for it has any files specified as // dependency hints. if(info->m_cmSourceFile != 0) @@ -123,12 +124,12 @@ void cmMakeDepend::GenerateDependInformation(cmDependInformation* info) // Dependency hints have been given. Use them to begin the // recursion. for(std::vector<std::string>::const_iterator file = - cFile.GetDepends().begin(); file != cFile.GetDepends().end(); + cFile.GetDepends().begin(); file != cFile.GetDepends().end(); ++file) { this->AddDependency(info, file->c_str()); } - + // Found dependency information. We are done. found = true; } @@ -137,8 +138,9 @@ void cmMakeDepend::GenerateDependInformation(cmDependInformation* info) if(!found) { // Try to find the file amongst the sources - cmSourceFile *srcFile = - m_Makefile->GetSource(cmSystemTools::GetFilenameWithoutExtension(path).c_str()); + cmSourceFile *srcFile = + m_Makefile->GetSource( + cmSystemTools::GetFilenameWithoutExtension(path).c_str()); if (srcFile) { if (srcFile->GetFullPath() == path) @@ -148,7 +150,7 @@ void cmMakeDepend::GenerateDependInformation(cmDependInformation* info) else { //try to guess which include path to use - for(std::vector<std::string>::iterator t = + for(std::vector<std::string>::iterator t = m_IncludeDirectories.begin(); t != m_IncludeDirectories.end(); ++t) { @@ -161,14 +163,14 @@ void cmMakeDepend::GenerateDependInformation(cmDependInformation* info) if (srcFile->GetFullPath() == incpath) { // set the path to the guessed path - info->m_FullPath = incpath; + info->m_FullPath = incpath; found=true; } } } } } - + if(!found) { // Couldn't find any dependency information. @@ -189,7 +191,8 @@ void cmMakeDepend::GenerateDependInformation(cmDependInformation* info) // #include directives 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()); if(!fin) { @@ -218,7 +221,7 @@ void cmMakeDepend::DependWalk(cmDependInformation* info) } continue; } - + // Add this file and all its dependencies. this->AddDependency(info, includeFile.c_str()); } @@ -228,7 +231,7 @@ void cmMakeDepend::DependWalk(cmDependInformation* info) void cmMakeDepend::AddDependency(cmDependInformation* info, const char* file) { - cmDependInformation* dependInfo = + cmDependInformation* dependInfo = this->GetDependInformation(file, info->m_PathOnly.c_str()); this->GenerateDependInformation(dependInfo); info->AddDependencies(dependInfo); @@ -239,7 +242,7 @@ cmDependInformation* cmMakeDepend::GetDependInformation(const char* file, { // Get the full path for the file so that lookup is unambiguous. std::string fullPath = this->FullPath(file, extraPath); - + // Try to find the file's instance of cmDependInformation. DependInformationMap::const_iterator result = m_DependInformationMap.find(fullPath); @@ -265,11 +268,11 @@ void cmMakeDepend::GenerateMakefileDependencies() { // Now create cmDependInformation objects for files in the directory cmTargets &tgts = m_Makefile->GetTargets(); - for(cmTargets::iterator l = tgts.begin(); + for(cmTargets::iterator l = tgts.begin(); l != tgts.end(); l++) { const std::vector<cmSourceFile*> &classes = l->second.GetSourceFiles(); - for(std::vector<cmSourceFile*>::const_iterator i = classes.begin(); + for(std::vector<cmSourceFile*>::const_iterator i = classes.begin(); i != classes.end(); ++i) { if(!(*i)->GetPropertyAsBool("HEADER_FILE_ONLY")) @@ -297,7 +300,7 @@ std::string cmMakeDepend::FullPath(const char* fname, const char *extraPath) { m = m_DirectoryToFileToPathMap.find(""); } - + if(m != m_DirectoryToFileToPathMap.end()) { FileToPathMap& map = m->second; @@ -314,7 +317,7 @@ std::string cmMakeDepend::FullPath(const char* fname, const char *extraPath) m_DirectoryToFileToPathMap[extraPath? extraPath: ""][fname] = fp; return fp; } - + for(std::vector<std::string>::iterator i = m_IncludeDirectories.begin(); i != m_IncludeDirectories.end(); ++i) { @@ -349,7 +352,7 @@ std::string cmMakeDepend::FullPath(const char* fname, const char *extraPath) return fp; } } - + // Couldn't find the file. return std::string(fname); } diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 0bd047f..e43e1da 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -9,8 +9,8 @@ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ @@ -78,7 +78,7 @@ #include <memory> // auto_ptr -void cmNeedBackwardsCompatibility(const std::string& variable, +void cmNeedBackwardsCompatibility(const std::string& variable, int access_type, void* ) { #ifdef CMAKE_BUILD_WITH_CMAKE @@ -86,12 +86,14 @@ void cmNeedBackwardsCompatibility(const std::string& variable, { std::string message = "An attempt was made to access a variable: "; message += variable; - message += " that has not been defined. Some variables were always defined " - "by CMake in versions prior to 1.6. To fix this you might need to set the " - "cache value of CMAKE_BACKWARDS_COMPATIBILITY to 1.4 or less. If you are " - "writing a CMakeList file, (or have already set " - "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."; + message += + " that has not been defined. Some variables were always defined " + "by CMake in versions prior to 1.6. To fix this you might need to set " + "the cache value of CMAKE_BACKWARDS_COMPATIBILITY to 1.4 or less. If " + "you are writing a CMakeList file, (or have already set " + "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()); } #else @@ -105,7 +107,7 @@ cmake::cmake() m_DebugTryCompile = false; m_ClearBuildSystem = false; m_FileComparison = new cmFileTimeComparison; - + #ifdef __APPLE__ struct rlimit rlp; if(!getrlimit(RLIMIT_STACK, &rlp)) @@ -126,8 +128,8 @@ cmake::cmake() if(getenv("MAKEFLAGS")) { cmSystemTools::PutEnv("MAKEFLAGS="); - } - + } + m_Verbose = false; m_InTryCompile = false; m_CacheManager = new cmCacheManager; @@ -202,7 +204,7 @@ bool cmake::CommandExists(const char* name) const return (m_Commands.find(sName) != m_Commands.end()); } -cmCommand *cmake::GetCommand(const char *name) +cmCommand *cmake::GetCommand(const char *name) { cmCommand* rm = 0; std::string sName = cmSystemTools::LowerCase(name); @@ -252,7 +254,7 @@ void cmake::AddCommand(cmCommand* wg) // Parse the args bool cmake::SetCacheArgs(const std::vector<std::string>& args) -{ +{ for(unsigned int i=1; i < args.size(); ++i) { std::string arg = args[i]; @@ -278,7 +280,7 @@ bool cmake::SetCacheArgs(const std::vector<std::string>& args) << "Should be: VAR:type=value\n"; cmSystemTools::Error("No cmake scrpt provided."); return false; - } + } } else if(arg.find("-C",0) == 0) { @@ -311,7 +313,7 @@ void cmake::ReadListFile(const char *path) // if a generator was not yet created, temporarily create one cmGlobalGenerator *gg = this->GetGlobalGenerator(); bool created = false; - + // if a generator was not specified use a generic one if (!gg) { @@ -338,7 +340,7 @@ void cmake::ReadListFile(const char *path) std::cerr << "Error processing file:" << path << "\n"; } } - + // free generic one if generated if (created) { @@ -422,7 +424,7 @@ void cmake::SetArgs(const std::vector<std::string>& args) { value = args[++i]; } - cmGlobalGenerator* gen = + cmGlobalGenerator* gen = this->CreateGlobalGenerator(value.c_str()); if(!gen) { @@ -520,28 +522,29 @@ void cmake::SetDirectoriesFromFile(const char* arg) { cmCacheManager* cachem = this->GetCacheManager(); 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->SetStartOutputDirectory(cachePath.c_str()); + this->SetHomeOutputDirectory(cachePath.c_str()); + this->SetStartOutputDirectory(cachePath.c_str()); this->SetHomeDirectory(it.GetValue()); this->SetStartDirectory(it.GetValue()); return; } } - + // If there is a CMakeLists.txt file, use it as the source tree. if(listPath.length() > 0) { this->SetHomeDirectory(listPath.c_str()); this->SetStartDirectory(listPath.c_str()); - + if(argIsFile) { // Source CMakeLists.txt file given. It was probably dropped // onto the executable in a GUI. Default to an in-source build. - this->SetHomeOutputDirectory(listPath.c_str()); - this->SetStartOutputDirectory(listPath.c_str()); + this->SetHomeOutputDirectory(listPath.c_str()); + this->SetStartOutputDirectory(listPath.c_str()); } else { @@ -549,11 +552,11 @@ void cmake::SetDirectoriesFromFile(const char* arg) // directory as build tree. std::string cwd = cmSystemTools::GetCurrentWorkingDirectory(); this->SetHomeOutputDirectory(cwd.c_str()); - this->SetStartOutputDirectory(cwd.c_str()); + this->SetStartOutputDirectory(cwd.c_str()); } return; } - + // We didn't find a CMakeLists.txt or CMakeCache.txt file from the // argument. Assume it is the path to the source tree, and use the // current working directory as the build tree. @@ -562,10 +565,11 @@ void cmake::SetDirectoriesFromFile(const char* arg) this->SetHomeDirectory(full.c_str()); this->SetStartDirectory(full.c_str()); this->SetHomeOutputDirectory(cwd.c_str()); - 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) { // Find our own executable. @@ -638,7 +642,7 @@ int cmake::AddCMakePaths(const char *arg0) ("CMAKE_EDIT_COMMAND", editCacheCommand.c_str(), "Path to cache edit program executable.", cmCacheManager::INTERNAL); } - + // do CMAKE_ROOT, look for the environment variable first std::string cMakeRoot; std::string modules; @@ -652,14 +656,14 @@ int cmake::AddCMakePaths(const char *arg0) // next try exe/.. cMakeRoot = cmSystemTools::GetProgramPath(cMakeSelf.c_str()); std::string::size_type slashPos = cMakeRoot.rfind("/"); - if(slashPos != std::string::npos) + if(slashPos != std::string::npos) { cMakeRoot = cMakeRoot.substr(0, slashPos); } // is there no Modules direcory there? - modules = cMakeRoot + "/Modules/CMake.cmake"; + modules = cMakeRoot + "/Modules/CMake.cmake"; } - + if (!cmSystemTools::FileExists(modules.c_str())) { // try exe/../share/cmake @@ -684,7 +688,7 @@ int cmake::AddCMakePaths(const char *arg0) #endif if (!cmSystemTools::FileExists(modules.c_str())) { - // try + // try cMakeRoot = cmSystemTools::GetProgramPath(cMakeSelf.c_str()); cMakeRoot += CMAKE_DATA_DIR; modules = cMakeRoot + "/Modules/CMake.cmake"; @@ -694,15 +698,15 @@ int cmake::AddCMakePaths(const char *arg0) // next try exe cMakeRoot = cmSystemTools::GetProgramPath(cMakeSelf.c_str()); // is there no Modules direcory there? - modules = cMakeRoot + "/Modules/CMake.cmake"; + modules = cMakeRoot + "/Modules/CMake.cmake"; } if (!cmSystemTools::FileExists(modules.c_str())) { // couldn't find modules cmSystemTools::Error("Could not find CMAKE_ROOT !!!\n" - "CMake has most likely not been installed correctly.\n" - "Modules directory not found in\n", - cMakeRoot.c_str()); + "CMake has most likely not been installed correctly.\n" + "Modules directory not found in\n", + cMakeRoot.c_str()); return 0; } this->m_CacheManager->AddCacheEntry @@ -723,20 +727,23 @@ void CMakeCommandUsage(const char* program) cmOStringStream errorStream; #ifdef CMAKE_BUILD_WITH_CMAKE - errorStream + errorStream << "cmake version " << cmVersion::GetCMakeVersion() << "\n"; #else - errorStream + errorStream << "cmake bootstrap\n"; #endif - errorStream + errorStream << "Usage: " << program << " -E [command] [arguments ...]\n" << "Available commands: \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_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" + << " copy file destination - copy file to destination (either file or " + "directory)\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" << " echo [string]... - displays arguments as text\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. 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 \"" << args[2].c_str() << "\" to \"" << args[3].c_str() @@ -856,17 +864,17 @@ int cmake::CMakeCommand(std::vector<std::string>& args) time(&time_start); clock_start = clock(); - + cmSystemTools::RunSingleCommand(command.c_str()); clock_finish = clock(); time(&time_finish); double clocks_per_sec = (double)CLOCKS_PER_SEC; - std::cout << "Elapsed time: " + std::cout << "Elapsed time: " << (long)(time_finish - time_start) << " s. (time)" - << ", " - << (double)(clock_finish - clock_start) / clocks_per_sec + << ", " + << (double)(clock_finish - clock_start) / clocks_per_sec << " s. (clock)" << "\n"; return 0; @@ -894,11 +902,11 @@ int cmake::CMakeCommand(std::vector<std::string>& args) } int retval = 0; int timeout = 0; - if ( cmSystemTools::RunSingleCommand(command.c_str(), 0, &retval, + if ( cmSystemTools::RunSingleCommand(command.c_str(), 0, &retval, directory.c_str(), true, timeout) ) { return retval; - } + } return 1; } @@ -1011,7 +1019,8 @@ int cmake::CMakeCommand(std::vector<std::string>& args) } 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()); return 1; @@ -1019,7 +1028,8 @@ int cmake::CMakeCommand(std::vector<std::string>& args) } 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()); return 1; @@ -1040,7 +1050,7 @@ int cmake::CMakeCommand(std::vector<std::string>& args) // Write registry value else if (args[1] == "write_regv" && args.size() > 3) { - return cmSystemTools::WriteRegistryValue(args[2].c_str(), + return cmSystemTools::WriteRegistryValue(args[2].c_str(), args[3].c_str()) ? 0 : 1; } @@ -1091,7 +1101,7 @@ cmGlobalGenerator* cmake::CreateGlobalGenerator(const char* name) } } -void cmake::SetHomeDirectory(const char* dir) +void cmake::SetHomeDirectory(const char* dir) { m_cmHomeDirectory = dir; cmSystemTools::ConvertToUnixSlashes(m_cmHomeDirectory); @@ -1127,7 +1137,7 @@ void cmake::SetGlobalGenerator(cmGlobalGenerator *gg) // set the new m_GlobalGenerator = gg; - // 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 // on windows. cmSystemTools::SetForceUnixPaths(m_GlobalGenerator->GetForceUnixPaths()); @@ -1177,15 +1187,16 @@ int cmake::DoPreConfigureChecks() err << "The source directory \"" << this->GetHomeDirectory() << "\" 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()); return -2; } - + // do a sanity check on some values if(m_CacheManager->GetCacheValue("CMAKE_HOME_DIRECTORY")) { - std::string cacheStart = + std::string cacheStart = m_CacheManager->GetCacheValue("CMAKE_HOME_DIRECTORY"); cacheStart += "/CMakeLists.txt"; std::string currentStart = this->GetHomeDirectory(); @@ -1226,12 +1237,13 @@ int cmake::Configure() } if ( !res ) { - m_CacheManager->AddCacheEntry("CMAKE_HOME_DIRECTORY", - this->GetHomeDirectory(), - "Start directory with the top level CMakeLists.txt file for this project", - cmCacheManager::INTERNAL); + m_CacheManager->AddCacheEntry("CMAKE_HOME_DIRECTORY", + this->GetHomeDirectory(), + "Start directory with the top level CMakeLists.txt file for this " + "project", + cmCacheManager::INTERNAL); } - + // set the default BACKWARDS compatibility to the current version if(!m_CacheManager->GetCacheValue("CMAKE_BACKWARDS_COMPATIBILITY")) { @@ -1239,11 +1251,12 @@ int cmake::Configure() sprintf(ver,"%i.%i",cmMakefile::GetMajorVersion(), cmMakefile::GetMinorVersion()); this->m_CacheManager->AddCacheEntry - ("CMAKE_BACKWARDS_COMPATIBILITY",ver, - "For backwards compatibility, what version of CMake commands and syntax should this version of CMake allow.", + ("CMAKE_BACKWARDS_COMPATIBILITY",ver, + "For backwards compatibility, what version of CMake commands and " + "syntax should this version of CMake allow.", cmCacheManager::STRING); - } - + } + // no generator specified on the command line if(!m_GlobalGenerator) { @@ -1254,10 +1267,11 @@ int cmake::Configure() } if(m_GlobalGenerator) { - // 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 // on windows. - cmSystemTools::SetForceUnixPaths(m_GlobalGenerator->GetForceUnixPaths()); + cmSystemTools::SetForceUnixPaths( + m_GlobalGenerator->GetForceUnixPaths()); } else { @@ -1265,7 +1279,8 @@ int cmake::Configure() this->SetGlobalGenerator(new cmGlobalBorlandMakefileGenerator); #elif defined(_WIN32) && !defined(__CYGWIN__) && !defined(CMAKE_BOOT_MINGW) 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); if (!(mp == "/registry")) { @@ -1273,7 +1288,8 @@ int cmake::Configure() } else { - mp = "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\7.1;InstallDir]"; + mp = "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft" + "\\VisualStudio\\7.1;InstallDir]"; cmSystemTools::ExpandRegistryValues(mp); if (!(mp == "/registry")) { @@ -1281,7 +1297,8 @@ int cmake::Configure() } else { - mp = "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\7.0;InstallDir]"; + mp = "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft" + "\\VisualStudio\\7.0;InstallDir]"; cmSystemTools::ExpandRegistryValues(mp); 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) { gen = new cmGlobalNMakeMakefileGenerator; @@ -1328,7 +1346,8 @@ int cmake::Configure() } 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.", cmCacheManager::INTERNAL); } @@ -1340,7 +1359,7 @@ int cmake::Configure() { m_GlobalGenerator->ClearEnabledLanguages(); } - + this->CleanupWrittenFiles(); // Truncate log files @@ -1352,7 +1371,7 @@ int cmake::Configure() // actually do the configure m_GlobalGenerator->Configure(); - + // Before saving the cache // if the project did not define one of the entries below, add them now // so users can edit the values in the cache: @@ -1361,30 +1380,31 @@ int cmake::Configure() if(!m_CacheManager->GetCacheValue("LIBRARY_OUTPUT_PATH")) { m_CacheManager->AddCacheEntry("LIBRARY_OUTPUT_PATH", "", - "Single output directory for building all libraries.", - cmCacheManager::PATH); - } + "Single output directory for building all libraries.", + cmCacheManager::PATH); + } if(!m_CacheManager->GetCacheValue("EXECUTABLE_OUTPUT_PATH")) { m_CacheManager->AddCacheEntry("EXECUTABLE_OUTPUT_PATH", "", - "Single output directory for building all executables.", - cmCacheManager::PATH); - } + "Single output directory for building all executables.", + cmCacheManager::PATH); + } if(!m_CacheManager->GetCacheValue("CMAKE_USE_RELATIVE_PATHS")) { m_CacheManager->AddCacheEntry("CMAKE_USE_RELATIVE_PATHS", false, - "If true, cmake will use relative paths in makefiles and projects."); + "If true, cmake will use relative paths in makefiles and projects."); cmCacheManager::CacheIterator it = m_CacheManager->GetCacheIterator("CMAKE_USE_RELATIVE_PATHS"); if ( !it.PropertyExists("ADVANCED") ) { it.SetProperty("ADVANCED", "1"); } - } - + } + if(cmSystemTools::GetFatalErrorOccured() && (!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 // user can select another. @@ -1409,13 +1429,16 @@ int cmake::Configure() bool cmake::CacheVersionMatches() { - const char* majv = m_CacheManager->GetCacheValue("CMAKE_CACHE_MAJOR_VERSION"); - const char* minv = m_CacheManager->GetCacheValue("CMAKE_CACHE_MINOR_VERSION"); - const char* relv = m_CacheManager->GetCacheValue("CMAKE_CACHE_RELEASE_VERSION"); + const char* majv + = m_CacheManager->GetCacheValue("CMAKE_CACHE_MAJOR_VERSION"); + const char* minv + = m_CacheManager->GetCacheValue("CMAKE_CACHE_MINOR_VERSION"); + const char* relv + = m_CacheManager->GetCacheValue("CMAKE_CACHE_RELEASE_VERSION"); bool cacheSameCMake = false; - if(majv && + if(majv && atoi(majv) == static_cast<int>(cmMakefile::GetMajorVersion()) - && minv && + && minv && atoi(minv) == static_cast<int>(cmMakefile::GetMinorVersion()) && relv && (strcmp(relv, cmMakefile::GetReleaseVersion()) == 0)) { @@ -1456,16 +1479,16 @@ int cmake::Run(const std::vector<std::string>& args, bool noconfigure) CMakeCommandUsage(args[0].c_str()); return -1; } - + // set the cmake command m_CMakeCommand = args[0]; - + if ( !m_ScriptMode ) { // load the cache if(this->LoadCache() < 0) { - cmSystemTools::Error("Error executing cmake::LoadCache(). Aborting.\n"); + cmSystemTools::Error("Error executing cmake::LoadCache(). Aborting.\n"); return -1; } } @@ -1510,7 +1533,7 @@ int cmake::Run(const std::vector<std::string>& args, bool noconfigure) { return 0; } - + // If we are doing global generate, we better set start and start // output directory to the root of the project. std::string oldstartdir = this->GetStartDirectory(); @@ -1550,26 +1573,26 @@ int cmake::Generate() return 0; } -unsigned int cmake::GetMajorVersion() -{ +unsigned int cmake::GetMajorVersion() +{ return cmMakefile::GetMajorVersion(); } unsigned int cmake::GetMinorVersion() -{ +{ return cmMakefile::GetMinorVersion(); } const char *cmake::GetReleaseVersion() -{ +{ return cmMakefile::GetReleaseVersion(); } -void cmake::AddCacheEntry(const char* key, const char* value, - const char* helpString, +void cmake::AddCacheEntry(const char* key, const char* value, + const char* helpString, int type) { - m_CacheManager->AddCacheEntry(key, value, + m_CacheManager->AddCacheEntry(key, value, helpString, cmCacheManager::CacheEntryType(type)); } @@ -1666,22 +1689,27 @@ int cmake::LoadCache() cacheFile += "/CMakeCache.txt"; 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; } } 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; } - + // setup CMAKE_ROOT and CMAKE_COMMAND if(!this->AddCMakePaths(m_CMakeCommand.c_str())) { return -3; - } + } // set the default BACKWARDS compatibility to the current version if(!m_CacheManager->GetCacheValue("CMAKE_BACKWARDS_COMPATIBILITY")) @@ -1690,11 +1718,12 @@ int cmake::LoadCache() sprintf(ver,"%i.%i",cmMakefile::GetMajorVersion(), cmMakefile::GetMinorVersion()); this->m_CacheManager->AddCacheEntry - ("CMAKE_BACKWARDS_COMPATIBILITY",ver, - "For backwards compatibility, what version of CMake commands and syntax should this version of CMake allow.", + ("CMAKE_BACKWARDS_COMPATIBILITY",ver, + "For backwards compatibility, what version of CMake commands and " + "syntax should this version of CMake allow.", cmCacheManager::STRING); } - + return 0; } @@ -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(); j != m_Commands.end(); ++j) @@ -1763,7 +1793,7 @@ void cmake::CleanupWrittenFiles() void cmake::UpdateConversionPathTable() { // Update the path conversion table with any specified file: - const char* tablepath = + const char* tablepath = m_CacheManager->GetCacheValue("CMAKE_PATH_TRANSLATION_FILE"); if(tablepath) @@ -1771,7 +1801,8 @@ void cmake::UpdateConversionPathTable() std::ifstream table( tablepath ); 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."); } else @@ -1844,7 +1875,7 @@ int cmake::CheckBuildSystem() out != outputs.end(); ++out) { int result = 0; - if(!m_FileComparison->FileTimeCompare(out->c_str(), + if(!m_FileComparison->FileTimeCompare(out->c_str(), dep->c_str(), &result) || result < 0) { @@ -1917,7 +1948,8 @@ const char* cmake::GetCTestCommand() return m_CTestCommand.c_str(); } - cmMakefile* mf = this->GetGlobalGenerator()->GetLocalGenerator(0)->GetMakefile(); + cmMakefile* mf + = this->GetGlobalGenerator()->GetLocalGenerator(0)->GetMakefile(); #ifdef CMAKE_BUILD_WITH_CMAKE m_CTestCommand = mf->GetRequiredDefinition("CMAKE_COMMAND"); m_CTestCommand = removeQuotes(m_CTestCommand); @@ -1962,7 +1994,8 @@ const char* cmake::GetCPackCommand() return m_CPackCommand.c_str(); } - cmMakefile* mf = this->GetGlobalGenerator()->GetLocalGenerator(0)->GetMakefile(); + cmMakefile* mf + = this->GetGlobalGenerator()->GetLocalGenerator(0)->GetMakefile(); #ifdef CMAKE_BUILD_WITH_CMAKE m_CPackCommand = mf->GetRequiredDefinition("CMAKE_COMMAND"); @@ -2031,10 +2064,12 @@ void cmake::GenerateGraphViz(const char* fileName) { 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; } - 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) \ @@ -2045,7 +2080,8 @@ void cmake::GenerateGraphViz(const char* fileName) } __set_if_not_set(graphType, "digraph", "GRAPHVIZ_GRAPH_TYPE"); __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"); const char* ignoreTargets = mf->GetDefinition("GRAPHVIZ_IGNORE_TARGETS"); std::set<cmStdString> ignoreTargetsSet; @@ -2054,12 +2090,14 @@ void cmake::GenerateGraphViz(const char* fileName) std::vector<std::string> ignoreTargetsVector; cmSystemTools::ExpandListArgument(ignoreTargets,ignoreTargetsVector); 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()); } } - + str << graphType << " " << graphName << " {" << std::endl; str << graphHeader << std::endl; @@ -2093,7 +2131,8 @@ void cmake::GenerateGraphViz(const char* fileName) sprintf(tgtName, "%s%d", graphNodePrefix, cnt++); targetNamesNodes[realTargetName] = tgtName; 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 @@ -2103,7 +2142,8 @@ void cmake::GenerateGraphViz(const char* fileName) cmTargets::iterator 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; const char* realTargetName = tit->first.c_str(); if ( ignoreTargetsSet.find(realTargetName) != ignoreTargetsSet.end() ) @@ -2118,7 +2158,8 @@ void cmake::GenerateGraphViz(const char* fileName) for ( llit = ll->begin(); llit != ll->end(); ++ llit ) { 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() ) { // Skip ignored targets @@ -2129,11 +2170,13 @@ void cmake::GenerateGraphViz(const char* fileName) sprintf(tgtName, "%s%d", graphNodePrefix, cnt++); targetDeps[libName] = 2; targetNamesNodes[libName] = tgtName; - //str << " \"" << tgtName << "\" [ label=\"" << libName << "\" shape=\"ellipse\"];" << std::endl; + //str << " \"" << tgtName << "\" [ label=\"" << libName + //<< "\" shape=\"ellipse\"];" << std::endl; } else { - std::map<cmStdString, int>::iterator depIt = targetDeps.find(libName); + std::map<cmStdString, int>::iterator depIt + = targetDeps.find(libName); if ( depIt == targetDeps.end() ) { targetDeps[libName] = 1; @@ -2148,22 +2191,27 @@ void cmake::GenerateGraphViz(const char* fileName) for ( depIt = targetDeps.begin(); depIt != targetDeps.end(); ++ depIt ) { 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() ) { // 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(); } - str << " \"" << tarIt->second.c_str() << "\" [ label=\"" << newTargetName << "\" shape=\""; + str << " \"" << tarIt->second.c_str() << "\" [ label=\"" + << newTargetName << "\" shape=\""; 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() ) { // 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(); } cmTarget* tg = tarTypeIt->second; @@ -2199,31 +2247,38 @@ void cmake::GenerateGraphViz(const char* fileName) cmTargets::iterator 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() ) { continue; } - std::map<cmStdString, cmStdString>::iterator cmakeTarIt = targetNamesNodes.find(tit->first.c_str()); - const cmTarget::LinkLibraries* ll = &(tit->second.GetOriginalLinkLibraries()); + std::map<cmStdString, cmStdString>::iterator cmakeTarIt + = targetNamesNodes.find(tit->first.c_str()); + const cmTarget::LinkLibraries* ll + = &(tit->second.GetOriginalLinkLibraries()); cmTarget::LinkLibraries::const_iterator llit; for ( llit = ll->begin(); llit != ll->end(); ++ llit ) { 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() ) { // 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(); } - 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 - //str << " \"node0\":f4 -> \"node12\"[color=\"#0000ff\" style=dotted]" << std::endl; + //str << " \"node0\":f4 -> \"node12\"[color=\"#0000ff\" style=dotted]" + //<< std::endl; // str << "}" << std::endl; } diff --git a/Source/cmakewizard.cxx b/Source/cmakewizard.cxx index 89236d8..79f4a95 100644 --- a/Source/cmakewizard.cxx +++ b/Source/cmakewizard.cxx @@ -9,8 +9,8 @@ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ @@ -23,8 +23,9 @@ cmakewizard::cmakewizard() m_ShowAdvanced = false; } - -void cmakewizard::AskUser(const char* key, cmCacheManager::CacheIterator& iter) + +void cmakewizard::AskUser(const char* key, + cmCacheManager::CacheIterator& iter) { printf("Variable Name: %s\n", key); const char* helpstring = iter.GetProperty("HELPSTRING"); @@ -34,7 +35,7 @@ void cmakewizard::AskUser(const char* key, cmCacheManager::CacheIterator& iter) char buffer[4096]; buffer[0] = 0; fgets(buffer, sizeof(buffer)-1, stdin); - + if(strlen(buffer) > 0) { std::string sbuffer = buffer; @@ -44,7 +45,7 @@ void cmakewizard::AskUser(const char* key, cmCacheManager::CacheIterator& iter) { value = sbuffer.substr(0, pos+1); } - + if ( value.size() > 0 ) { if(iter.GetType() == cmCacheManager::PATH || @@ -67,7 +68,7 @@ void cmakewizard::AskUser(const char* key, cmCacheManager::CacheIterator& iter) bool cmakewizard::AskAdvanced() { - printf("Would you like to see advanced options? [No]:"); + printf("Would you like to see advanced options? [No]:"); char buffer[4096]; buffer[0] = 0; fgets(buffer, sizeof(buffer)-1, stdin); @@ -105,7 +106,8 @@ int cmakewizard::RunWizard(std::vector<std::string> const& args) { asked = false; // 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(); this->ShowMessage("\n"); @@ -115,9 +117,9 @@ int cmakewizard::RunWizard(std::vector<std::string> const& args) cmCacheManager::CacheIterator i = cachem->NewIterator(); // iterate over all entries in the cache for(;!i.IsAtEnd(); i.Next()) - { + { std::string key = i.GetName(); - if( i.GetType() == cmCacheManager::INTERNAL || + if( i.GetType() == cmCacheManager::INTERNAL || i.GetType() == cmCacheManager::STATIC || i.GetType() == cmCacheManager::UNINITIALIZED ) { @@ -136,7 +138,7 @@ int cmakewizard::RunWizard(std::vector<std::string> const& args) } } else - { + { if(m_ShowAdvanced || !i.GetPropertyAsBool("ADVANCED")) { this->AskUser(key.c_str(), i); |