diff options
author | Ken Martin <ken.martin@kitware.com> | 2006-05-12 15:56:09 (GMT) |
---|---|---|
committer | Ken Martin <ken.martin@kitware.com> | 2006-05-12 15:56:09 (GMT) |
commit | 7dc8a92246ced17f9f3cf6161f2ef07bdda51014 (patch) | |
tree | fd7f79bd2ffe4fe9d60d302403aeb317661c9d8a | |
parent | 4b176d7f45bc436caccfd582d98c0bf0123a6bb2 (diff) | |
download | CMake-7dc8a92246ced17f9f3cf6161f2ef07bdda51014.zip CMake-7dc8a92246ced17f9f3cf6161f2ef07bdda51014.tar.gz CMake-7dc8a92246ced17f9f3cf6161f2ef07bdda51014.tar.bz2 |
STYLE: fix line length
-rw-r--r-- | Source/cmLinkDirectoriesCommand.cxx | 3 | ||||
-rw-r--r-- | Source/cmLinkLibrariesCommand.cxx | 6 | ||||
-rw-r--r-- | Source/cmListCommand.cxx | 18 | ||||
-rw-r--r-- | Source/cmListFileCache.cxx | 6 | ||||
-rw-r--r-- | Source/cmLoadCacheCommand.cxx | 3 | ||||
-rw-r--r-- | Source/cmLoadCommandCommand.h | 6 | ||||
-rw-r--r-- | Source/cmLocalGenerator.cxx | 207 | ||||
-rw-r--r-- | Source/cmLocalVisualStudio6Generator.cxx | 160 | ||||
-rw-r--r-- | Source/cmLocalVisualStudio7Generator.cxx | 187 | ||||
-rw-r--r-- | Source/cmLocalVisualStudio7Generator.h | 6 |
10 files changed, 376 insertions, 226 deletions
diff --git a/Source/cmLinkDirectoriesCommand.cxx b/Source/cmLinkDirectoriesCommand.cxx index 90f54b61..5eeb5bb 100644 --- a/Source/cmLinkDirectoriesCommand.cxx +++ b/Source/cmLinkDirectoriesCommand.cxx @@ -17,7 +17,8 @@ #include "cmLinkDirectoriesCommand.h" // cmLinkDirectoriesCommand -bool cmLinkDirectoriesCommand::InitialPass(std::vector<std::string> const& args) +bool cmLinkDirectoriesCommand +::InitialPass(std::vector<std::string> const& args) { if(args.size() < 1 ) { diff --git a/Source/cmLinkLibrariesCommand.cxx b/Source/cmLinkLibrariesCommand.cxx index 37d7b08..94f0051 100644 --- a/Source/cmLinkLibrariesCommand.cxx +++ b/Source/cmLinkLibrariesCommand.cxx @@ -33,7 +33,8 @@ bool cmLinkLibrariesCommand::InitialPass(std::vector<std::string> const& args) ++i; if(i == args.end()) { - this->SetError("The \"debug\" argument must be followed by a library"); + this->SetError("The \"debug\" argument must be followed by " + "a library"); return false; } this->Makefile->AddLinkLibrary(i->c_str(), @@ -44,7 +45,8 @@ bool cmLinkLibrariesCommand::InitialPass(std::vector<std::string> const& args) ++i; if(i == args.end()) { - this->SetError("The \"optimized\" argument must be followed by a library"); + this->SetError("The \"optimized\" argument must be followed by " + "a library"); return false; } this->Makefile->AddLinkLibrary(i->c_str(), diff --git a/Source/cmListCommand.cxx b/Source/cmListCommand.cxx index 6516f20..1a1a9d8 100644 --- a/Source/cmListCommand.cxx +++ b/Source/cmListCommand.cxx @@ -153,7 +153,9 @@ bool cmListCommand::HandleGetCommand(std::vector<std::string> const& args) if ( item < 0 || nitem <= (size_t)item ) { cmOStringStream str; - str << "index: " << item << " out of range (-" << varArgsExpanded.size() << ", " << varArgsExpanded.size()-1 << ")"; + str << "index: " << item << " out of range (-" + << varArgsExpanded.size() << ", " + << varArgsExpanded.size()-1 << ")"; this->SetError(str.str().c_str()); return false; } @@ -221,7 +223,9 @@ bool cmListCommand::HandleInsertCommand(std::vector<std::string> const& args) if ( item < 0 || nitem <= (size_t)item ) { cmOStringStream str; - str << "index: " << item << " out of range (-" << varArgsExpanded.size() << ", " << varArgsExpanded.size()-1 << ")"; + str << "index: " << item << " out of range (-" + << varArgsExpanded.size() << ", " + << varArgsExpanded.size()-1 << ")"; this->SetError(str.str().c_str()); return false; } @@ -293,11 +297,13 @@ bool cmListCommand::HandleRemoveCommand(std::vector<std::string> const& args) } //---------------------------------------------------------------------------- -bool cmListCommand::HandleRemoveItemCommand(std::vector<std::string> const& args) +bool cmListCommand +::HandleRemoveItemCommand(std::vector<std::string> const& args) { if(args.size() < 3) { - this->SetError("sub-command REMOVE_ITEM requires at least two arguments."); + this->SetError("sub-command REMOVE_ITEM requires at least " + "two arguments."); return false; } @@ -322,7 +328,9 @@ bool cmListCommand::HandleRemoveItemCommand(std::vector<std::string> const& args if ( item < 0 || nitem <= (size_t)item ) { cmOStringStream str; - str << "index: " << item << " out of range (-" << varArgsExpanded.size() << ", " << varArgsExpanded.size()-1 << ")"; + str << "index: " << item << " out of range (-" + << varArgsExpanded.size() << ", " + << varArgsExpanded.size()-1 << ")"; this->SetError(str.str().c_str()); return false; } diff --git a/Source/cmListFileCache.cxx b/Source/cmListFileCache.cxx index d520d4a..9457a0c 100644 --- a/Source/cmListFileCache.cxx +++ b/Source/cmListFileCache.cxx @@ -44,7 +44,8 @@ bool cmListFile::ParseFile(const char* filename, bool requireProjectCommand) if(!cmListFileLexer_SetFileName(lexer, filename)) { cmListFileLexer_Delete(lexer); - cmSystemTools::Error("cmListFileCache: error can not open file ", filename); + cmSystemTools::Error("cmListFileCache: error can not open file ", + filename); return false; } @@ -190,7 +191,8 @@ bool cmListFileCacheParseFunction(cmListFileLexer* lexer, // Error. cmOStringStream error; error << "Error in cmake code at\n" - << filename << ":" << cmListFileLexer_GetCurrentLine(lexer) << ":\n" + << filename << ":" << cmListFileLexer_GetCurrentLine(lexer) + << ":\n" << "Parse error. Function missing ending \")\". " << "Instead found " << cmListFileLexer_GetTypeAsString(lexer, token->type) diff --git a/Source/cmLoadCacheCommand.cxx b/Source/cmLoadCacheCommand.cxx index 1cd8abc..062a7a6 100644 --- a/Source/cmLoadCacheCommand.cxx +++ b/Source/cmLoadCacheCommand.cxx @@ -205,7 +205,8 @@ bool cmLoadCacheCommand::ParseEntry(const char* entry, std::string& var, // input line is: key:type=value cmsys::RegularExpression reg("^([^:]*):([^=]*)=(.*[^\t ]|[\t ]*)[\t ]*$"); // input line is: "key":type=value - cmsys::RegularExpression regQuoted("^\"([^\"]*)\":([^=]*)=(.*[^\t ]|[\t ]*)[\t ]*$"); + cmsys::RegularExpression + regQuoted("^\"([^\"]*)\":([^=]*)=(.*[^\t ]|[\t ]*)[\t ]*$"); bool flag = false; if(regQuoted.find(entry)) { diff --git a/Source/cmLoadCommandCommand.h b/Source/cmLoadCommandCommand.h index 1ffb225..76aca9e 100644 --- a/Source/cmLoadCommandCommand.h +++ b/Source/cmLoadCommandCommand.h @@ -63,9 +63,9 @@ public: " LOAD_COMMAND(COMMAND_NAME <loc1> [loc2 ...])\n" "The given locations are searched for a library whose name is " "cmCOMMAND_NAME. If found, it is loaded as a module and the command " - "is added to the set of available CMake commands. Usually, TRY_COMPILE " - "is used before this command to compile the module. If the command " - "is successfully loaded a variable named\n" + "is added to the set of available CMake commands. Usually, " + "TRY_COMPILE is used before this command to compile the module. " + "If the command is successfully loaded a variable named\n" " CMAKE_LOADED_COMMAND_<COMMAND_NAME>\n" "will be set to the full path of the module that was loaded. " "Otherwise the variable will not be set."; diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 4241e4c..cbe6532 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -94,12 +94,16 @@ void cmLocalGenerator::SetupPathConversions() outdir = cmSystemTools::CollapseFullPath(this->Makefile->GetStartDirectory()); cmSystemTools::SplitPath(outdir.c_str(), this->StartDirectoryComponents); - outdir = - cmSystemTools::CollapseFullPath(this->Makefile->GetHomeOutputDirectory()); - cmSystemTools::SplitPath(outdir.c_str(), this->HomeOutputDirectoryComponents); - outdir = - cmSystemTools::CollapseFullPath(this->Makefile->GetStartOutputDirectory()); -cmSystemTools::SplitPath(outdir.c_str(), this->StartOutputDirectoryComponents); + + outdir = cmSystemTools::CollapseFullPath + (this->Makefile->GetHomeOutputDirectory()); + cmSystemTools::SplitPath(outdir.c_str(), + this->HomeOutputDirectoryComponents); + + outdir = cmSystemTools::CollapseFullPath + (this->Makefile->GetStartOutputDirectory()); + cmSystemTools::SplitPath(outdir.c_str(), + this->StartOutputDirectoryComponents); } @@ -139,22 +143,28 @@ void cmLocalGenerator::GenerateTestFiles() fout.SetCopyIfDifferent(true); fout << "# CMake generated Testfile for " << std::endl - << "# Source directory: " << this->Makefile->GetStartDirectory() << std::endl - << "# Build directory: " << this->Makefile->GetStartOutputDirectory() << std::endl - << "# " << std::endl - << "# This file replicates the SUBDIRS() and ADD_TEST() commands from the source" << std::endl - << "# tree CMakeLists.txt file, skipping any SUBDIRS() or ADD_TEST() commands" << std::endl - << "# that are excluded by CMake control structures, i.e. IF() commands." << std::endl - << "#" << std::endl - << "# The next line is critical for Dart to work" << std::endl - << "# Duh :-)" << std::endl << std::endl; - - const char* testIncludeFile = this->Makefile->GetProperty("TEST_INCLUDE_FILE"); + << "# Source directory: " + << this->Makefile->GetStartDirectory() << std::endl + << "# Build directory: " + << this->Makefile->GetStartOutputDirectory() << std::endl + << "# " << std::endl + << "# This file replicates the SUBDIRS() and ADD_TEST() commands " + << "from the source" << std::endl + << "# tree CMakeLists.txt file, skipping any SUBDIRS() or " + << "ADD_TEST() commands" << std::endl + << "# that are excluded by CMake control structures, i.e. IF() " + << "commands." << std::endl + << "#" << std::endl + << "# The next line is critical for Dart to work" << std::endl + << "# Duh :-)" << std::endl << std::endl; + + const char* testIncludeFile = + this->Makefile->GetProperty("TEST_INCLUDE_FILE"); if ( testIncludeFile ) { fout << "INCLUDE(\"" << testIncludeFile << "\")" << std::endl; } - + const std::vector<cmTest*> *tests = this->Makefile->GetTests(); std::vector<cmTest*>::const_iterator it; for ( it = tests->begin(); it != tests->end(); ++ it ) @@ -162,15 +172,16 @@ void cmLocalGenerator::GenerateTestFiles() cmTest* test = *it; fout << "ADD_TEST("; fout << test->GetName() << " \"" << test->GetCommand() << "\""; - + std::vector<cmStdString>::const_iterator argit; for (argit = test->GetArguments().begin(); - argit != test->GetArguments().end(); ++argit) + argit != test->GetArguments().end(); ++argit) { // Just double-quote all arguments so they are re-parsed // correctly by the test system. fout << " \""; - for(std::string::const_iterator c = argit->begin(); c != argit->end(); ++c) + for(std::string::const_iterator c = argit->begin(); + c != argit->end(); ++c) { // Escape quotes within arguments. We should escape // backslashes too but we cannot because it makes the result @@ -233,7 +244,8 @@ void cmLocalGenerator::GenerateTestFiles() outDir += "/"; for(i = 0; i < this->Children.size(); ++i) { - std::string binP = this->Children[i]->GetMakefile()->GetStartOutputDirectory(); + std::string binP = + this->Children[i]->GetMakefile()->GetStartOutputDirectory(); cmSystemTools::ReplaceString(binP, outDir.c_str(), ""); if ( i > 0 ) { @@ -279,7 +291,8 @@ void cmLocalGenerator::GenerateInstallRules() // Compute the set of configurations. std::vector<std::string> configurationTypes; - if(const char* types = this->Makefile->GetDefinition("CMAKE_CONFIGURATION_TYPES")) + if(const char* types = + this->Makefile->GetDefinition("CMAKE_CONFIGURATION_TYPES")) { cmSystemTools::ExpandListArgument(types, configurationTypes); } @@ -333,11 +346,12 @@ void cmLocalGenerator::GenerateInstallRules() fout << "# Install script for directory: " << this->Makefile->GetCurrentDirectory() << std::endl << std::endl; fout << "# Set the install prefix" << std::endl - << "IF(NOT DEFINED CMAKE_INSTALL_PREFIX)" << std::endl - << " SET(CMAKE_INSTALL_PREFIX \"" << prefix << "\")" << std::endl - << "ENDIF(NOT DEFINED CMAKE_INSTALL_PREFIX)" << std::endl - << "STRING(REGEX REPLACE \"/$\" \"\" CMAKE_INSTALL_PREFIX \"${CMAKE_INSTALL_PREFIX}\")" << std::endl - << std::endl; + << "IF(NOT DEFINED CMAKE_INSTALL_PREFIX)" << std::endl + << " SET(CMAKE_INSTALL_PREFIX \"" << prefix << "\")" << std::endl + << "ENDIF(NOT DEFINED CMAKE_INSTALL_PREFIX)" << std::endl + << "STRING(REGEX REPLACE \"/$\" \"\" CMAKE_INSTALL_PREFIX " + << "\"${CMAKE_INSTALL_PREFIX}\")" << std::endl + << std::endl; // Write support code for generating per-configuration install rules. fout << @@ -349,7 +363,8 @@ void cmLocalGenerator::GenerateInstallRules() " ELSE(BUILD_TYPE)\n" " SET(CMAKE_INSTALL_CONFIG_NAME \"" << default_config << "\")\n" " ENDIF(BUILD_TYPE)\n" - " MESSAGE(STATUS \"Install configuration: \\\"${CMAKE_INSTALL_CONFIG_NAME}\\\"\")\n" + " MESSAGE(STATUS \"Install configuration: " + "\\\"${CMAKE_INSTALL_CONFIG_NAME}\\\"\")\n" "ENDIF(NOT CMAKE_INSTALL_CONFIG_NAME)\n" "\n"; @@ -369,7 +384,8 @@ void cmLocalGenerator::GenerateInstallRules() // Ask each install generator to write its code. std::vector<cmInstallGenerator*> const& installers = this->Makefile->GetInstallGenerators(); - for(std::vector<cmInstallGenerator*>::const_iterator gi = installers.begin(); + for(std::vector<cmInstallGenerator*>::const_iterator + gi = installers.begin(); gi != installers.end(); ++gi) { (*gi)->Generate(fout, config, configurationTypes); @@ -574,7 +590,8 @@ void cmLocalGenerator::AddBuildTargetRule(const char* llang, cmTarget& target) ofname += "/"; ofname += (*i)->GetSourceName() + outExt; objVector.push_back(ofname); - this->AddCustomCommandToCreateObject(ofname.c_str(), llang, *(*i), target); + this->AddCustomCommandToCreateObject(ofname.c_str(), + llang, *(*i), target); objs += this->Convert(ofname.c_str(),START_OUTPUT,MAKEFILE); objs += " "; } @@ -637,11 +654,13 @@ void cmLocalGenerator::AddBuildTargetRule(const char* llang, cmTarget& target) comment.c_str(), this->Makefile->GetStartOutputDirectory() ); - target.GetSourceFiles().push_back(this->Makefile->GetSource(targetFullPath.c_str())); + target.GetSourceFiles().push_back + (this->Makefile->GetSource(targetFullPath.c_str())); } -void cmLocalGenerator::CreateCustomTargetsAndCommands(std::set<cmStdString> const& lang) +void cmLocalGenerator +::CreateCustomTargetsAndCommands(std::set<cmStdString> const& lang) { cmTargets &tgts = this->Makefile->GetTargets(); for(cmTargets::iterator l = tgts.begin(); @@ -655,11 +674,13 @@ void cmLocalGenerator::CreateCustomTargetsAndCommands(std::set<cmStdString> cons case cmTarget::MODULE_LIBRARY: case cmTarget::EXECUTABLE: { - const char* llang = target.GetLinkerLanguage(this->GetGlobalGenerator()); + const char* llang = + target.GetLinkerLanguage(this->GetGlobalGenerator()); if(!llang) { - cmSystemTools::Error("CMake can not determine linker language for target:", - target.GetName()); + cmSystemTools::Error + ("CMake can not determine linker language for target:", + target.GetName()); return; } // if the language is not in the set lang then create custom @@ -680,8 +701,6 @@ void cmLocalGenerator::CreateCustomTargetsAndCommands(std::set<cmStdString> cons } } - - // List of variables that are replaced when // rules are expanced. These variables are // replaced in the form <var> with GetSafeDefinition(var). @@ -863,12 +882,14 @@ cmLocalGenerator::ExpandRuleVariable(std::string const& variable, } if(actualReplace == variable) { - std::string replace = this->Makefile->GetSafeDefinition(variable.c_str()); + std::string replace = + this->Makefile->GetSafeDefinition(variable.c_str()); // if the variable is not a FLAG then treat it like a path if(variable.find("_FLAG") == variable.npos) { std::string ret = this->ConvertToOutputForExisting(replace.c_str()); - // if there is a required first argument to the compiler add it to the compiler string + // if there is a required first argument to the compiler add it + // to the compiler string if(compilerArg1) { ret += " "; @@ -978,15 +999,16 @@ const char* cmLocalGenerator::GetIncludeFlags(const char* lang) { quotePaths = true; } - bool repeatFlag = true; // should the include flag be repeated like ie. -IA -IB + bool repeatFlag = true; + // should the include flag be repeated like ie. -IA -IB if(!sep) { sep = " "; } else { - // if there is a separator then the flag is not repeated but is only given once - // i.e. -classpath a:b:c + // if there is a separator then the flag is not repeated but is only + // given once i.e. -classpath a:b:c repeatFlag = false; } bool flagUsed = false; @@ -1001,7 +1023,9 @@ const char* cmLocalGenerator::GetIncludeFlags(const char* lang) frameworkDir = cmSystemTools::CollapseFullPath(frameworkDir.c_str()); if(emitted.insert(frameworkDir).second) { - includeFlags << "-F" << this->ConvertToOutputForExisting(frameworkDir.c_str()) << " "; + includeFlags + << "-F" + << this->ConvertToOutputForExisting(frameworkDir.c_str()) << " "; } continue; } @@ -1081,14 +1105,16 @@ void cmLocalGenerator::GetIncludeDirectories(std::vector<std::string>& dirs) this->Makefile->GetDefinition("VTK_SOURCE_DIR"); if(vtkSourceDir) { - const char* vtk_major = this->Makefile->GetDefinition("VTK_MAJOR_VERSION"); - const char* vtk_minor = this->Makefile->GetDefinition("VTK_MINOR_VERSION"); + const char* vtk_major = + this->Makefile->GetDefinition("VTK_MAJOR_VERSION"); + const char* vtk_minor = + this->Makefile->GetDefinition("VTK_MINOR_VERSION"); vtk_major = vtk_major? vtk_major : "4"; vtk_minor = vtk_minor? vtk_minor : "4"; int vmajor = 0; int vminor = 0; - if(sscanf(vtk_major, "%d", &vmajor) && sscanf(vtk_minor, "%d", &vminor) && - vmajor == 4 && vminor <= 4) + if(sscanf(vtk_major, "%d", &vmajor) && + sscanf(vtk_minor, "%d", &vminor) && vmajor == 4 && vminor <= 4) { includeSourceDir = true; } @@ -1116,8 +1142,8 @@ void cmLocalGenerator::GetIncludeDirectories(std::vector<std::string>& dirs) // This can cause problems with certain standard library // implementations because the wrong headers may be found first. emitted.insert("/usr/include"); - if(const char* implicitIncludes = - this->Makefile->GetDefinition("CMAKE_PLATFORM_IMPLICIT_INCLUDE_DIRECTORIES")) + if(const char* implicitIncludes = this->Makefile->GetDefinition + ("CMAKE_PLATFORM_IMPLICIT_INCLUDE_DIRECTORIES")) { std::vector<std::string> implicitIncludeVec; cmSystemTools::ExpandListArgument(implicitIncludes, implicitIncludeVec); @@ -1128,7 +1154,8 @@ void cmLocalGenerator::GetIncludeDirectories(std::vector<std::string>& dirs) } // Get the project-specified include directories. - std::vector<std::string>& includes = this->Makefile->GetIncludeDirectories(); + std::vector<std::string>& includes = + this->Makefile->GetIncludeDirectories(); // Support putting all the in-project include directories first if // it is requested by the project. @@ -1170,15 +1197,18 @@ void cmLocalGenerator::GetTargetFlags(std::string& linkLibs, std::string& linkFlags, cmTarget& target) { - std::string buildType = this->Makefile->GetSafeDefinition("CMAKE_BUILD_TYPE"); + std::string buildType = + this->Makefile->GetSafeDefinition("CMAKE_BUILD_TYPE"); buildType = cmSystemTools::UpperCase(buildType); - const char* libraryLinkVariable = "CMAKE_SHARED_LINKER_FLAGS"; // default to shared library + const char* libraryLinkVariable = + "CMAKE_SHARED_LINKER_FLAGS"; // default to shared library switch(target.GetType()) { case cmTarget::STATIC_LIBRARY: { - const char* targetLinkFlags = target.GetProperty("STATIC_LIBRARY_FLAGS"); + const char* targetLinkFlags = + target.GetProperty("STATIC_LIBRARY_FLAGS"); if(targetLinkFlags) { linkFlags += targetLinkFlags; @@ -1200,7 +1230,8 @@ void cmLocalGenerator::GetTargetFlags(std::string& linkLibs, linkFlags += this->Makefile->GetSafeDefinition(build.c_str()); linkFlags += " "; } - if(this->Makefile->IsOn("WIN32") && !(this->Makefile->IsOn("CYGWIN") || this->Makefile->IsOn("MINGW"))) + if(this->Makefile->IsOn("WIN32") && + !(this->Makefile->IsOn("CYGWIN") || this->Makefile->IsOn("MINGW"))) { const std::vector<cmSourceFile*>& sources = target.GetSourceFiles(); for(std::vector<cmSourceFile*>::const_iterator i = sources.begin(); @@ -1208,8 +1239,10 @@ void cmLocalGenerator::GetTargetFlags(std::string& linkLibs, { if((*i)->GetSourceExtension() == "def") { - linkFlags += this->Makefile->GetSafeDefinition("CMAKE_LINK_DEF_FILE_FLAG"); - linkFlags += this->Convert((*i)->GetFullPath().c_str(),START_OUTPUT,MAKEFILE); + linkFlags += + this->Makefile->GetSafeDefinition("CMAKE_LINK_DEF_FILE_FLAG"); + linkFlags += this->Convert((*i)->GetFullPath().c_str(), + START_OUTPUT,MAKEFILE); linkFlags += " "; } } @@ -1235,7 +1268,8 @@ void cmLocalGenerator::GetTargetFlags(std::string& linkLibs, break; case cmTarget::EXECUTABLE: { - linkFlags += this->Makefile->GetSafeDefinition("CMAKE_EXE_LINKER_FLAGS"); + linkFlags += + this->Makefile->GetSafeDefinition("CMAKE_EXE_LINKER_FLAGS"); linkFlags += " "; if(buildType.size()) { @@ -1244,11 +1278,13 @@ void cmLocalGenerator::GetTargetFlags(std::string& linkLibs, linkFlags += this->Makefile->GetSafeDefinition(build.c_str()); linkFlags += " "; } - 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:", - target.GetName()); + cmSystemTools::Error + ("CMake can not determine linker language for target:", + target.GetName()); return; } std::string langVar = "CMAKE_"; @@ -1264,21 +1300,24 @@ void cmLocalGenerator::GetTargetFlags(std::string& linkLibs, cmOStringStream linklibs; this->OutputLinkLibraries(linklibs, target, false); linkLibs = linklibs.str(); - if(cmSystemTools::IsOn(this->Makefile->GetDefinition("BUILD_SHARED_LIBS"))) + if(cmSystemTools::IsOn + (this->Makefile->GetDefinition("BUILD_SHARED_LIBS"))) { - std::string sFlagVar = std::string("CMAKE_SHARED_BUILD_") + linkLanguage - + std::string("_FLAGS"); + std::string sFlagVar = std::string("CMAKE_SHARED_BUILD_") + + linkLanguage + std::string("_FLAGS"); linkFlags += this->Makefile->GetSafeDefinition(sFlagVar.c_str()); linkFlags += " "; } if ( target.GetPropertyAsBool("WIN32_EXECUTABLE") ) { - linkFlags += this->Makefile->GetSafeDefinition("CMAKE_CREATE_WIN32_EXE"); + linkFlags += + this->Makefile->GetSafeDefinition("CMAKE_CREATE_WIN32_EXE"); linkFlags += " "; } else { - linkFlags += this->Makefile->GetSafeDefinition("CMAKE_CREATE_CONSOLE_EXE"); + linkFlags += + this->Makefile->GetSafeDefinition("CMAKE_CREATE_CONSOLE_EXE"); linkFlags += " "; } const char* targetLinkFlags = target.GetProperty("LINK_FLAGS"); @@ -1323,7 +1362,8 @@ void cmLocalGenerator::OutputLinkLibraries(std::ostream& fout, std::string runtimeSep; const char* config = this->Makefile->GetDefinition("CMAKE_BUILD_TYPE"); - const char* linkLanguage = tgt.GetLinkerLanguage(this->GetGlobalGenerator()); + const char* linkLanguage = + tgt.GetLinkerLanguage(this->GetGlobalGenerator()); if(!linkLanguage) { cmSystemTools:: @@ -1348,8 +1388,10 @@ void cmLocalGenerator::OutputLinkLibraries(std::ostream& fout, // Some search paths should never be emitted emitted.insert(""); emitted.insert("/usr/lib"); - std::string libPathFlag = this->Makefile->GetRequiredDefinition("CMAKE_LIBRARY_PATH_FLAG"); - std::string libLinkFlag = this->Makefile->GetSafeDefinition("CMAKE_LINK_LIBRARY_FLAG"); + std::string libPathFlag = + this->Makefile->GetRequiredDefinition("CMAKE_LIBRARY_PATH_FLAG"); + std::string libLinkFlag = + this->Makefile->GetSafeDefinition("CMAKE_LINK_LIBRARY_FLAG"); // collect all the flags needed for linking libraries std::string linkLibs; @@ -1466,12 +1508,12 @@ void cmLocalGenerator::OutputLinkLibraries(std::ostream& fout, } //---------------------------------------------------------------------------- -void -cmLocalGenerator::ComputeLinkInformation(cmTarget& target, - const char* config, - std::vector<cmStdString>& outLibs, - std::vector<cmStdString>& outDirs, - std::vector<cmStdString>* fullPathLibs) +void cmLocalGenerator +::ComputeLinkInformation(cmTarget& target, + const char* config, + std::vector<cmStdString>& outLibs, + std::vector<cmStdString>& outDirs, + std::vector<cmStdString>* fullPathLibs) { // Compute which library configuration to link. cmTarget::LinkLibraryType linkType = cmTarget::OPTIMIZED; @@ -1779,7 +1821,8 @@ cmLocalGenerator::ConstructScript(const cmCustomCommandLines& commandLines, // if CMAKE_MSVCIDE_RUN_PATH is set. if(this->Makefile->GetDefinition("MSVC_IDE")) { - const char* extraPath = this->Makefile->GetDefinition("CMAKE_MSVCIDE_RUN_PATH"); + const char* extraPath = + this->Makefile->GetDefinition("CMAKE_MSVCIDE_RUN_PATH"); if(extraPath) { script += "set PATH="; @@ -1863,22 +1906,26 @@ std::string cmLocalGenerator::Convert(const char* source, case HOME: //result = cmSystemTools::CollapseFullPath(result.c_str()); result = this->GlobalGenerator-> - ConvertToRelativePath(this->HomeDirectoryComponents, result.c_str()); + ConvertToRelativePath(this->HomeDirectoryComponents, + result.c_str()); break; case START: //result = cmSystemTools::CollapseFullPath(result.c_str()); result = this->GlobalGenerator-> - ConvertToRelativePath(this->StartDirectoryComponents, result.c_str()); + ConvertToRelativePath(this->StartDirectoryComponents, + result.c_str()); break; case HOME_OUTPUT: //result = cmSystemTools::CollapseFullPath(result.c_str()); result = this->GlobalGenerator-> - ConvertToRelativePath(this->HomeOutputDirectoryComponents, result.c_str()); + ConvertToRelativePath(this->HomeOutputDirectoryComponents, + result.c_str()); break; case START_OUTPUT: //result = cmSystemTools::CollapseFullPath(result.c_str()); result = this->GlobalGenerator-> - ConvertToRelativePath(this->StartOutputDirectoryComponents, result.c_str()); + ConvertToRelativePath(this->StartOutputDirectoryComponents, + result.c_str()); break; case FULL: result = cmSystemTools::CollapseFullPath(result.c_str()); diff --git a/Source/cmLocalVisualStudio6Generator.cxx b/Source/cmLocalVisualStudio6Generator.cxx index b0a63af..a12d0e7 100644 --- a/Source/cmLocalVisualStudio6Generator.cxx +++ b/Source/cmLocalVisualStudio6Generator.cxx @@ -48,7 +48,8 @@ void cmLocalVisualStudio6Generator::OutputDSPFile() if(strcmp(this->Makefile->GetStartOutputDirectory(), this->Makefile->GetHomeDirectory()) != 0) { - if(!cmSystemTools::MakeDirectory(this->Makefile->GetStartOutputDirectory())) + if(!cmSystemTools::MakeDirectory + (this->Makefile->GetStartOutputDirectory())) { cmSystemTools::Error("Error creating directory ", this->Makefile->GetStartOutputDirectory()); @@ -178,7 +179,8 @@ void cmLocalVisualStudio6Generator::OutputDSPFile() } } -void cmLocalVisualStudio6Generator::CreateSingleDSP(const char *lname, cmTarget &target) +void cmLocalVisualStudio6Generator::CreateSingleDSP(const char *lname, + cmTarget &target) { // add to the list of projects std::string pname = lname; @@ -209,7 +211,8 @@ void cmLocalVisualStudio6Generator::AddDSPBuildRule(cmTarget& tgt) { std::string dspname = tgt.GetName(); dspname += ".dsp.cmake"; - const char* dsprule = this->Makefile->GetRequiredDefinition("CMAKE_COMMAND"); + const char* dsprule = + this->Makefile->GetRequiredDefinition("CMAKE_COMMAND"); cmCustomCommandLine commandLine; commandLine.push_back(dsprule); std::string makefileIn = this->Makefile->GetStartDirectory(); @@ -219,8 +222,8 @@ void cmLocalVisualStudio6Generator::AddDSPBuildRule(cmTarget& tgt) comment += makefileIn; std::string args; args = "-H"; - args += - this->Convert(this->Makefile->GetHomeDirectory(),START_OUTPUT, SHELL, true); + args += this->Convert(this->Makefile->GetHomeDirectory(), + START_OUTPUT, SHELL, true); commandLine.push_back(args); args = "-B"; args += @@ -329,8 +332,8 @@ void cmLocalVisualStudio6Generator::WriteDSPFile(std::ostream& fout, { // Add the file to the list of sources. std::string source = (*i)->GetFullPath(); - cmSourceGroup& sourceGroup = this->Makefile->FindSourceGroup(source.c_str(), - sourceGroups); + cmSourceGroup& sourceGroup = + this->Makefile->FindSourceGroup(source.c_str(), sourceGroups); sourceGroup.AssignSource(*i); // while we are at it, if it is a .rule file then for visual studio 6 we // must generate it @@ -341,7 +344,8 @@ void cmLocalVisualStudio6Generator::WriteDSPFile(std::ostream& fout, cmSystemTools::ReplaceString(source, "$(IntDir)/", ""); #if defined(_WIN32) || defined(__CYGWIN__) std::ofstream fout(source.c_str(), - std::ios::binary | std::ios::out | std::ios::trunc); + std::ios::binary | std::ios::out + | std::ios::trunc); #else std::ofstream fout(source.c_str(), std::ios::out | std::ios::trunc); @@ -371,7 +375,9 @@ void cmLocalVisualStudio6Generator::WriteDSPFile(std::ostream& fout, this->WriteDSPFooter(fout); } -void cmLocalVisualStudio6Generator::WriteGroup(const cmSourceGroup *sg, cmTarget target, std::ostream &fout, const char *libName) +void cmLocalVisualStudio6Generator +::WriteGroup(const cmSourceGroup *sg, cmTarget target, + std::ostream &fout, const char *libName) { const std::vector<const cmSourceFile *> &sourceFiles = sg->GetSourceFiles(); @@ -405,8 +411,8 @@ void cmLocalVisualStudio6Generator::WriteGroup(const cmSourceGroup *sg, cmTarget compileFlags += cflags; } - const char* lang = - this->GlobalGenerator->GetLanguageFromExtension((*sf)->GetSourceExtension().c_str()); + const char* lang = this->GlobalGenerator-> + GetLanguageFromExtension((*sf)->GetSourceExtension().c_str()); if(lang && strcmp(lang, "CXX") == 0) { // force a C++ file type @@ -461,7 +467,8 @@ void cmLocalVisualStudio6Generator::WriteGroup(const cmSourceGroup *sg, cmTarget else if(compileFlags.size()) { for(std::vector<std::string>::iterator i - = this->Configurations.begin(); i != this->Configurations.end(); ++i) + = this->Configurations.begin(); + i != this->Configurations.end(); ++i) { if (i == this->Configurations.begin()) { @@ -580,7 +587,8 @@ cmLocalVisualStudio6Generator fout << "\n\n"; if(outputs.empty()) { - fout << source << "_force : \"$(SOURCE)\" \"$(INTDIR)\" \"$(OUTDIR)\"\n\t"; + fout << source + << "_force : \"$(SOURCE)\" \"$(INTDIR)\" \"$(OUTDIR)\"\n\t"; fout << command << "\n\n"; } else @@ -623,7 +631,8 @@ void cmLocalVisualStudio6Generator::SetBuildType(BuildType b, cmTarget& target) { std::string root= this->Makefile->GetRequiredDefinition("CMAKE_ROOT"); - const char *def= this->Makefile->GetDefinition( "MSPROJECT_TEMPLATE_DIRECTORY"); + const char *def= + this->Makefile->GetDefinition( "MSPROJECT_TEMPLATE_DIRECTORY"); if( def) { @@ -683,7 +692,8 @@ void cmLocalVisualStudio6Generator::SetBuildType(BuildType b, } // reset this->Configurations - this->Configurations.erase(this->Configurations.begin(), this->Configurations.end()); + this->Configurations.erase(this->Configurations.begin(), + this->Configurations.end()); // now add all the configurations possible std::string line; while(cmSystemTools::GetLineFromStream(fin, line)) @@ -761,7 +771,8 @@ cmLocalVisualStudio6Generator::CreateTargetRules(cmTarget &target, // Write the post-build rules. Make sure no continuation character // is put on the last line. - int postbuild_total = static_cast<int>(target.GetPostBuildCommands().size()); + int postbuild_total = + static_cast<int>(target.GetPostBuildCommands().size()); int postbuild_count = 0; const char* postbuild_newline = "\\\n\t"; if(postbuild_total > 0) @@ -859,7 +870,8 @@ void cmLocalVisualStudio6Generator lpath = "."; } std::string lpathIntDir = libPath + "$(INTDIR)"; - lpathIntDir = this->ConvertToOptionallyRelativeOutputPath(lpathIntDir.c_str()); + lpathIntDir = + this->ConvertToOptionallyRelativeOutputPath(lpathIntDir.c_str()); if(pathEmitted.insert(lpath).second) { libOptions += " /LIBPATH:"; @@ -891,7 +903,8 @@ void cmLocalVisualStudio6Generator lpath = "."; } std::string lpathIntDir = exePath + "$(INTDIR)"; - lpathIntDir = this->ConvertToOptionallyRelativeOutputPath(lpathIntDir.c_str()); + lpathIntDir = + this->ConvertToOptionallyRelativeOutputPath(lpathIntDir.c_str()); if(pathEmitted.insert(lpath).second) { @@ -931,7 +944,8 @@ void cmLocalVisualStudio6Generator lpath = "."; } std::string lpathIntDir = path + "$(INTDIR)"; - lpathIntDir = this->ConvertToOptionallyRelativeOutputPath(lpathIntDir.c_str()); + lpathIntDir = + this->ConvertToOptionallyRelativeOutputPath(lpathIntDir.c_str()); if(pathEmitted.insert(lpath).second) { libOptions += " /LIBPATH:"; @@ -975,8 +989,10 @@ void cmLocalVisualStudio6Generator cmTarget* tgt = this->GlobalGenerator->FindTarget(0, j->first.c_str()); if(tgt) { - lib = cmSystemTools::GetFilenameWithoutExtension(tgt->GetFullName().c_str()); - libDebug = cmSystemTools::GetFilenameWithoutExtension(tgt->GetFullName("Debug").c_str()); + lib = cmSystemTools::GetFilenameWithoutExtension + (tgt->GetFullName().c_str()); + libDebug = cmSystemTools::GetFilenameWithoutExtension + (tgt->GetFullName("Debug").c_str()); lib += ".lib"; libDebug += ".lib"; } @@ -991,7 +1007,8 @@ void cmLocalVisualStudio6Generator } } lib = this->ConvertToOptionallyRelativeOutputPath(lib.c_str()); - libDebug = this->ConvertToOptionallyRelativeOutputPath(libDebug.c_str()); + libDebug = + this->ConvertToOptionallyRelativeOutputPath(libDebug.c_str()); if (j->second == cmTarget::GENERAL) { @@ -1030,15 +1047,18 @@ void cmLocalVisualStudio6Generator std::string extraLinkOptions; if(target.GetType() == cmTarget::EXECUTABLE) { - extraLinkOptions = this->Makefile->GetRequiredDefinition("CMAKE_EXE_LINKER_FLAGS"); + extraLinkOptions = + this->Makefile->GetRequiredDefinition("CMAKE_EXE_LINKER_FLAGS"); } if(target.GetType() == cmTarget::SHARED_LIBRARY) { - extraLinkOptions = this->Makefile->GetRequiredDefinition("CMAKE_SHARED_LINKER_FLAGS"); + extraLinkOptions = + this->Makefile->GetRequiredDefinition("CMAKE_SHARED_LINKER_FLAGS"); } if(target.GetType() == cmTarget::MODULE_LIBRARY) { - extraLinkOptions = this->Makefile->GetRequiredDefinition("CMAKE_MODULE_LINKER_FLAGS"); + extraLinkOptions = + this->Makefile->GetRequiredDefinition("CMAKE_MODULE_LINKER_FLAGS"); } // Get extra linker options for this target. @@ -1053,11 +1073,13 @@ void cmLocalVisualStudio6Generator target.GetType() <= cmTarget::MODULE_LIBRARY) { // Get the language to use for linking. - 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:", - target.GetName()); + cmSystemTools::Error + ("CMake can not determine linker language for target:", + target.GetName()); return; } @@ -1077,7 +1099,8 @@ void cmLocalVisualStudio6Generator } // Compute the real name of the target. - std::string outputName = "(OUTPUT_NAME is for libraries and executables only)"; + std::string outputName = + "(OUTPUT_NAME is for libraries and executables only)"; std::string outputNameDebug = outputName; std::string outputNameRelease = outputName; std::string outputNameMinSizeRel = outputName; @@ -1201,17 +1224,25 @@ void cmLocalVisualStudio6Generator #endif // Substitute the real output name into the template. - cmSystemTools::ReplaceString(line, "OUTPUT_NAME_DEBUG", outputNameDebug.c_str()); - cmSystemTools::ReplaceString(line, "OUTPUT_NAME_RELEASE", outputNameRelease.c_str()); - cmSystemTools::ReplaceString(line, "OUTPUT_NAME_MINSIZEREL", outputNameMinSizeRel.c_str()); - cmSystemTools::ReplaceString(line, "OUTPUT_NAME_RELWITHDEBINFO", outputNameRelWithDebInfo.c_str()); + cmSystemTools::ReplaceString(line, "OUTPUT_NAME_DEBUG", + outputNameDebug.c_str()); + cmSystemTools::ReplaceString(line, "OUTPUT_NAME_RELEASE", + outputNameRelease.c_str()); + cmSystemTools::ReplaceString(line, "OUTPUT_NAME_MINSIZEREL", + outputNameMinSizeRel.c_str()); + cmSystemTools::ReplaceString(line, "OUTPUT_NAME_RELWITHDEBINFO", + outputNameRelWithDebInfo.c_str()); cmSystemTools::ReplaceString(line, "OUTPUT_NAME", outputName.c_str()); // Substitute the proper link information into the template. - cmSystemTools::ReplaceString(line, "CM_MULTILINE_OPTIONS_DEBUG", optionsDebug.c_str()); - cmSystemTools::ReplaceString(line, "CM_MULTILINE_OPTIONS_RELEASE", optionsRelease.c_str()); - cmSystemTools::ReplaceString(line, "CM_MULTILINE_OPTIONS_MINSIZEREL", optionsMinSizeRel.c_str()); - cmSystemTools::ReplaceString(line, "CM_MULTILINE_OPTIONS_RELWITHDEBINFO", optionsRelWithDebInfo.c_str()); + cmSystemTools::ReplaceString(line, "CM_MULTILINE_OPTIONS_DEBUG", + optionsDebug.c_str()); + cmSystemTools::ReplaceString(line, "CM_MULTILINE_OPTIONS_RELEASE", + optionsRelease.c_str()); + cmSystemTools::ReplaceString(line, "CM_MULTILINE_OPTIONS_MINSIZEREL", + optionsMinSizeRel.c_str()); + cmSystemTools::ReplaceString(line, "CM_MULTILINE_OPTIONS_RELWITHDEBINFO", + optionsRelWithDebInfo.c_str()); cmSystemTools::ReplaceString(line, "BUILD_INCLUDES", this->IncludeOptions.c_str()); @@ -1220,13 +1251,14 @@ void cmLocalVisualStudio6Generator // are already quoted in the template file, // we need to remove the quotes here, we still need // to convert to output path for unix to win32 conversion - cmSystemTools::ReplaceString(line, "LIBRARY_OUTPUT_PATH", - removeQuotes( - this->ConvertToOptionallyRelativeOutputPath(libPath.c_str())).c_str()); - cmSystemTools::ReplaceString(line, "EXECUTABLE_OUTPUT_PATH", - removeQuotes( - this->ConvertToOptionallyRelativeOutputPath(exePath.c_str())).c_str()); - + cmSystemTools::ReplaceString + (line, "LIBRARY_OUTPUT_PATH", + removeQuotes(this->ConvertToOptionallyRelativeOutputPath + (libPath.c_str())).c_str()); + cmSystemTools::ReplaceString + (line, "EXECUTABLE_OUTPUT_PATH", + removeQuotes(this->ConvertToOptionallyRelativeOutputPath + (exePath.c_str())).c_str()); cmSystemTools::ReplaceString(line, "EXTRA_DEFINES", @@ -1244,11 +1276,13 @@ void cmLocalVisualStudio6Generator if(target.GetType() >= cmTarget::EXECUTABLE && target.GetType() <= cmTarget::MODULE_LIBRARY) { - 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:", - target.GetName()); + cmSystemTools::Error + ("CMake can not determine linker language for target:", + target.GetName()); return; } // if CXX is on and the target contains cxx code then add the cxx flags @@ -1260,7 +1294,8 @@ void cmLocalVisualStudio6Generator std::string flagVar = baseFlagVar + "_RELEASE"; flagsRelease = this->Makefile->GetSafeDefinition(flagVar.c_str()); flagsRelease += " -DCMAKE_INTDIR=\\\"Release\\\" "; - if(const char* targetLinkFlags = target.GetProperty("LINK_FLAGS_RELEASE")) + if(const char* targetLinkFlags = + target.GetProperty("LINK_FLAGS_RELEASE")) { flagsRelease += targetLinkFlags; flagsRelease += " "; @@ -1268,7 +1303,8 @@ void cmLocalVisualStudio6Generator flagVar = baseFlagVar + "_MINSIZEREL"; flagsMinSize = this->Makefile->GetSafeDefinition(flagVar.c_str()); flagsMinSize += " -DCMAKE_INTDIR=\\\"MinSizeRel\\\" "; - if(const char* targetLinkFlags = target.GetProperty("LINK_FLAGS_MINSIZEREL")) + if(const char* targetLinkFlags = + target.GetProperty("LINK_FLAGS_MINSIZEREL")) { flagsMinSize += targetLinkFlags; flagsMinSize += " "; @@ -1286,7 +1322,8 @@ void cmLocalVisualStudio6Generator flagVar = baseFlagVar + "_RELWITHDEBINFO"; flagsDebugRel = this->Makefile->GetSafeDefinition(flagVar.c_str()); flagsDebugRel += " -DCMAKE_INTDIR=\\\"RelWithDebInfo\\\" "; - if(const char* targetLinkFlags = target.GetProperty("LINK_FLAGS_RELWITHDEBINFO")) + if(const char* targetLinkFlags = + target.GetProperty("LINK_FLAGS_RELWITHDEBINFO")) { flagsDebugRel += targetLinkFlags; flagsDebugRel += " "; @@ -1313,10 +1350,14 @@ void cmLocalVisualStudio6Generator // There are not separate CXX and C template files, so we use the same // variable names. The previous code sets up flags* variables to contain // the correct C or CXX flags - cmSystemTools::ReplaceString(line, "CMAKE_CXX_FLAGS_MINSIZEREL", flagsMinSize.c_str()); - cmSystemTools::ReplaceString(line, "CMAKE_CXX_FLAGS_DEBUG", flagsDebug.c_str()); - cmSystemTools::ReplaceString(line, "CMAKE_CXX_FLAGS_RELWITHDEBINFO", flagsDebugRel.c_str()); - cmSystemTools::ReplaceString(line, "CMAKE_CXX_FLAGS_RELEASE", flagsRelease.c_str()); + cmSystemTools::ReplaceString(line, "CMAKE_CXX_FLAGS_MINSIZEREL", + flagsMinSize.c_str()); + cmSystemTools::ReplaceString(line, "CMAKE_CXX_FLAGS_DEBUG", + flagsDebug.c_str()); + cmSystemTools::ReplaceString(line, "CMAKE_CXX_FLAGS_RELWITHDEBINFO", + flagsDebugRel.c_str()); + cmSystemTools::ReplaceString(line, "CMAKE_CXX_FLAGS_RELEASE", + flagsRelease.c_str()); cmSystemTools::ReplaceString(line, "CMAKE_CXX_FLAGS", flags.c_str()); fout << line.c_str() << std::endl; } @@ -1337,11 +1378,12 @@ void cmLocalVisualStudio6Generator::WriteDSPFooter(std::ostream& fout) } } -//----------------------------------------------------------------------------- -void cmLocalVisualStudio6Generator::ComputeLinkOptions(cmTarget& target, - const char* configName, - const std::string extraOptions, - std::string& options) +//---------------------------------------------------------------------------- +void cmLocalVisualStudio6Generator +::ComputeLinkOptions(cmTarget& target, + const char* configName, + const std::string extraOptions, + std::string& options) { // Compute the link information for this configuration. std::vector<cmStdString> linkLibs; diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx index 6b2becc..8117a26 100644 --- a/Source/cmLocalVisualStudio7Generator.cxx +++ b/Source/cmLocalVisualStudio7Generator.cxx @@ -54,7 +54,8 @@ void cmLocalVisualStudio7Generator::OutputVCProjFile() if(strcmp(this->Makefile->GetStartOutputDirectory(), this->Makefile->GetHomeDirectory()) != 0) { - if(!cmSystemTools::MakeDirectory(this->Makefile->GetStartOutputDirectory())) + if(!cmSystemTools::MakeDirectory + (this->Makefile->GetStartOutputDirectory())) { cmSystemTools::Error("Error creating directory ", this->Makefile->GetStartOutputDirectory()); @@ -78,7 +79,8 @@ void cmLocalVisualStudio7Generator::OutputVCProjFile() this->ExecutableOutputPath = ""; if (this->Makefile->GetDefinition("EXECUTABLE_OUTPUT_PATH")) { - this->ExecutableOutputPath = this->Makefile->GetDefinition("EXECUTABLE_OUTPUT_PATH"); + this->ExecutableOutputPath = + this->Makefile->GetDefinition("EXECUTABLE_OUTPUT_PATH"); } if(this->ExecutableOutputPath.size()) { @@ -134,7 +136,8 @@ void cmLocalVisualStudio7Generator::OutputVCProjFile() } } -void cmLocalVisualStudio7Generator::CreateSingleVCProj(const char *lname, cmTarget &target) +void cmLocalVisualStudio7Generator +::CreateSingleVCProj(const char *lname, cmTarget &target) { // add to the list of projects std::string pname = lname; @@ -164,7 +167,8 @@ void cmLocalVisualStudio7Generator::AddVCProjBuildRule(cmTarget& tgt) { std::string dspname = tgt.GetName(); dspname += ".vcproj.cmake"; - const char* dsprule = this->Makefile->GetRequiredDefinition("CMAKE_COMMAND"); + const char* dsprule = + this->Makefile->GetRequiredDefinition("CMAKE_COMMAND"); cmCustomCommandLine commandLine; commandLine.push_back(dsprule); std::string makefileIn = this->Makefile->GetStartDirectory(); @@ -174,8 +178,8 @@ void cmLocalVisualStudio7Generator::AddVCProjBuildRule(cmTarget& tgt) comment += makefileIn; std::string args; args = "-H"; - args += - this->Convert(this->Makefile->GetHomeDirectory(), START_OUTPUT, SHELL, true); + args += this->Convert(this->Makefile->GetHomeDirectory(), + START_OUTPUT, SHELL, true); commandLine.push_back(args); args = "-B"; args += @@ -224,7 +228,9 @@ void cmLocalVisualStudio7Generator::WriteConfigurations(std::ostream& fout, cmTarget &target) { std::vector<std::string> *configs = - static_cast<cmGlobalVisualStudio7Generator *>(this->GlobalGenerator)->GetConfigurations(); + static_cast<cmGlobalVisualStudio7Generator *> + (this->GlobalGenerator)->GetConfigurations(); + fout << "\t<Configurations>\n"; for( std::vector<std::string>::iterator i = configs->begin(); i != configs->end(); ++i) @@ -243,17 +249,17 @@ struct cmVS7FlagTable const char* value; // string value }; -// fill the table here -// currently the comment field is not used for anything other than documentation -// NOTE: Make sure the longer commandFlag comes FIRST! +// fill the table here currently the comment field is not used for +// anything other than documentation NOTE: Make sure the longer +// commandFlag comes FIRST! cmVS7FlagTable cmLocalVisualStudio7GeneratorFlagTable[] = { // 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"}, - {"BasicRuntimeChecks", "RTCu", "Uninitialized Variables ", "2"}, - {"BasicRuntimeChecks", "RTC1", "Both stack and uninitialized checks ", "3"}, + {"BasicRuntimeChecks", "GZ", "Stack frame checks", "1"}, + {"BasicRuntimeChecks", "RTCsu", "Both stack and uninitialized checks", "3"}, + {"BasicRuntimeChecks", "RTCs", "Stack frame checks", "1"}, + {"BasicRuntimeChecks", "RTCu", "Uninitialized Variables ", "2"}, + {"BasicRuntimeChecks", "RTC1", "Both stack and uninitialized checks ", "3"}, {"DebugInformationFormat", "Z7", "debug format", "1"}, {"DebugInformationFormat", "Zd", "debug format", "2"}, {"DebugInformationFormat", "Zi", "debug format", "3"}, @@ -299,11 +305,13 @@ cmVS7FlagTable cmLocalVisualStudio7GeneratorFlagTable[] = {"ExceptionHandling", "EHsc", "enable c++ exceptions", "TRUE"}, {"ExceptionHandling", "GX", "enable c++ exceptions", "TRUE"}, {"GlobalOptimizations", "Og", "Global Optimize", "TRUE"}, - {"ImproveFloatingPointConsistency", "Op", "ImproveFloatingPointConsistency", "TRUE"}, + {"ImproveFloatingPointConsistency", "Op", + "ImproveFloatingPointConsistency", "TRUE"}, {"MinimalRebuild", "Gm", "minimal rebuild", "TRUE"}, {"OmitFramePointers", "Oy", "OmitFramePointers", "TRUE"}, {"OptimizeForWindowsApplication", "GA", "Optimize for windows", "TRUE"}, - {"RuntimeTypeInfo", "GR", "Turn on Run time type information for c++", "TRUE"}, + {"RuntimeTypeInfo", "GR", + "Turn on Run time type information for c++", "TRUE"}, {"SmallerTypeCheck", "RTCc", "smaller type check", "TRUE"}, {"SuppressStartupBanner", "nologo", "SuppressStartupBanner", "TRUE"}, {"WarnAsError", "WX", "Treat warnings as errors", "TRUE"}, @@ -379,11 +387,13 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout, std::string flags; if(strcmp(configType, "10") != 0) { - 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:", - target.GetName()); + cmSystemTools::Error + ("CMake can not determine linker language for target:", + target.GetName()); return; } if(strcmp(linkLanguage, "C") == 0 || strcmp(linkLanguage, "CXX") == 0) @@ -446,16 +456,16 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout, // 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, - &cmLocalVisualStudio7GeneratorFlagTable[0], - flags); + this->FillFlagMapFromCommandFlags + (flagMap, &cmLocalVisualStudio7GeneratorFlagTable[0], flags); std::string defineFlags = this->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, - &cmLocalVisualStudio7GeneratorFlagTable[0], - defineFlags); + this->FillFlagMapFromCommandFlags + (flagMap, &cmLocalVisualStudio7GeneratorFlagTable[0], defineFlags); + // output remaining flags that were not mapped to anything fout << this->EscapeForXML(flags.c_str()).c_str(); fout << " -DCMAKE_INTDIR=\\"" << configName << "\\"" @@ -477,7 +487,8 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout, } if ( this->Makefile->GetDefinition("CMAKE_CXX_WARNING_LEVEL") ) { - flagMap["WarningLevel"] = this->Makefile->GetDefinition("CMAKE_CXX_WARNING_LEVEL"); + flagMap["WarningLevel"] = + this->Makefile->GetDefinition("CMAKE_CXX_WARNING_LEVEL"); } // Now copy the flag map into the xml for the file @@ -508,7 +519,8 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout, fout << "\"\n"; fout << "\t\t\t\tAssemblerListingLocation=\"" << configName << "\"\n"; fout << "\t\t\t\tObjectFile=\"$(IntDir)\\\"\n"; - std::map<cmStdString, cmStdString>::iterator mi = flagMap.find("DebugInformationFormat"); + std::map<cmStdString, cmStdString>::iterator mi = + flagMap.find("DebugInformationFormat"); if(mi != flagMap.end() && mi->second != "1") { fout << "\t\t\t\tProgramDatabaseFileName=\"" @@ -602,10 +614,12 @@ cmLocalVisualStudio7Generator ::GetBuildTypeLinkerFlags(std::string rootLinkerFlags, const char* configName) { std::string configTypeUpper = cmSystemTools::UpperCase(configName); - std::string extraLinkOptionsBuildTypeDef = rootLinkerFlags + "_" + configTypeUpper; + std::string extraLinkOptionsBuildTypeDef = + rootLinkerFlags + "_" + configTypeUpper; std::string extraLinkOptionsBuildType = - this->Makefile->GetRequiredDefinition(extraLinkOptionsBuildTypeDef.c_str()); + this->Makefile->GetRequiredDefinition + (extraLinkOptionsBuildTypeDef.c_str()); return extraLinkOptionsBuildType; } @@ -620,18 +634,24 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout, std::string extraLinkOptions; if(target.GetType() == cmTarget::EXECUTABLE) { - extraLinkOptions = this->Makefile->GetRequiredDefinition("CMAKE_EXE_LINKER_FLAGS") + - std::string(" ") + GetBuildTypeLinkerFlags("CMAKE_EXE_LINKER_FLAGS", configName); + extraLinkOptions = + this->Makefile->GetRequiredDefinition("CMAKE_EXE_LINKER_FLAGS") + + std::string(" ") + + GetBuildTypeLinkerFlags("CMAKE_EXE_LINKER_FLAGS", configName); } if(target.GetType() == cmTarget::SHARED_LIBRARY) { - extraLinkOptions = this->Makefile->GetRequiredDefinition("CMAKE_SHARED_LINKER_FLAGS") + - std::string(" ") + GetBuildTypeLinkerFlags("CMAKE_SHARED_LINKER_FLAGS", configName); + extraLinkOptions = + this->Makefile->GetRequiredDefinition("CMAKE_SHARED_LINKER_FLAGS") + + std::string(" ") + + GetBuildTypeLinkerFlags("CMAKE_SHARED_LINKER_FLAGS", configName); } if(target.GetType() == cmTarget::MODULE_LIBRARY) { - extraLinkOptions = this->Makefile->GetRequiredDefinition("CMAKE_MODULE_LINKER_FLAGS") + - std::string(" ") + GetBuildTypeLinkerFlags("CMAKE_MODULE_LINKER_FLAGS", configName); + extraLinkOptions = + this->Makefile->GetRequiredDefinition("CMAKE_MODULE_LINKER_FLAGS") + + std::string(" ") + + GetBuildTypeLinkerFlags("CMAKE_MODULE_LINKER_FLAGS", configName); } const char* targetLinkFlags = target.GetProperty("LINK_FLAGS"); @@ -650,10 +670,10 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout, extraLinkOptions += targetLinkFlags; } std::map<cmStdString, cmStdString> flagMap; - this-> - FillFlagMapFromCommandFlags(flagMap, - &cmLocalVisualStudio7GeneratorLinkFlagTable[0], - extraLinkOptions); + this->FillFlagMapFromCommandFlags + (flagMap, &cmLocalVisualStudio7GeneratorLinkFlagTable[0], + extraLinkOptions); + switch(target.GetType()) { case cmTarget::STATIC_LIBRARY: @@ -679,11 +699,13 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout, this->ComputeLinkInformation(target, configName, linkLibs, linkDirs); // Get the language to use for linking. - 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:", - target.GetName()); + cmSystemTools::Error + ("CMake can not determine linker language for target:", + target.GetName()); return; } @@ -746,9 +768,11 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout, temp = this->LibraryOutputPath; temp += configName; temp += "/"; - temp += cmSystemTools::GetFilenameWithoutLastExtension(targetFullName.c_str()); + temp += + cmSystemTools::GetFilenameWithoutLastExtension(targetFullName.c_str()); temp += ".lib"; - fout << "\t\t\t\tImportLibrary=\"" << this->ConvertToXMLOutputPathSingle(temp.c_str()) << "\"/>\n"; + fout << "\t\t\t\tImportLibrary=\"" + << this->ConvertToXMLOutputPathSingle(temp.c_str()) << "\"/>\n"; } break; case cmTarget::EXECUTABLE: @@ -759,11 +783,13 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout, this->ComputeLinkInformation(target, configName, linkLibs, linkDirs); // Get the language to use for linking. - 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:", - target.GetName()); + cmSystemTools::Error + ("CMake can not determine linker language for target:", + target.GetName()); return; } @@ -793,7 +819,8 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout, temp += configName; temp += "/"; temp += targetFullName; - fout << "\t\t\t\tOutputFile=\"" << this->ConvertToXMLOutputPathSingle(temp.c_str()) << "\"\n"; + fout << "\t\t\t\tOutputFile=\"" + << this->ConvertToXMLOutputPathSingle(temp.c_str()) << "\"\n"; for(std::map<cmStdString, cmStdString>::iterator i = flagMap.begin(); i != flagMap.end(); ++i) { @@ -834,8 +861,9 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout, } } -void cmLocalVisualStudio7Generator::OutputModuleDefinitionFile(std::ostream& fout, - cmTarget &target) +void cmLocalVisualStudio7Generator +::OutputModuleDefinitionFile(std::ostream& fout, + cmTarget &target) { std::vector<cmSourceFile*> const& classes = target.GetSourceFiles(); for(std::vector<cmSourceFile*>::const_iterator i = classes.begin(); @@ -998,8 +1026,10 @@ void cmLocalVisualStudio7Generator::WriteVCProjFile(std::ostream& fout, this->WriteVCProjFooter(fout); } -void cmLocalVisualStudio7Generator::WriteGroup(const cmSourceGroup *sg, cmTarget target, - std::ostream &fout, const char *libName, std::vector<std::string> *configs) +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 = sg->GetSourceFiles(); @@ -1044,9 +1074,11 @@ void cmLocalVisualStudio7Generator::WriteGroup(const cmSourceGroup *sg, cmTarget compileFlags += " "; compileFlags += cflags; } - const char* lang = - this->GlobalGenerator->GetLanguageFromExtension((*sf)->GetSourceExtension().c_str()); - const char* linkLanguage = target.GetLinkerLanguage(this->GetGlobalGenerator()); + const char* lang = this->GlobalGenerator->GetLanguageFromExtension + ((*sf)->GetSourceExtension().c_str()); + const char* linkLanguage = target.GetLinkerLanguage + (this->GetGlobalGenerator()); + // if the source file does not match the linker language // then force c or c++ if(linkLanguage && lang && strcmp(lang, linkLanguage) != 0) @@ -1090,15 +1122,17 @@ void cmLocalVisualStudio7Generator::WriteGroup(const cmSourceGroup *sg, cmTarget if (command) { // Construct the entire set of commands in one string. - std::string script = this->ConstructScript(command->GetCommandLines(), - command->GetWorkingDirectory()); + std::string script = + this->ConstructScript(command->GetCommandLines(), + command->GetWorkingDirectory()); std::string comment = this->ConstructComment(*command); const char* flags = compileFlags.size() ? compileFlags.c_str(): 0; this->WriteCustomRule(fout, source.c_str(), script.c_str(), comment.c_str(), command->GetDepends(), command->GetOutputs(), flags); } - else if(compileFlags.size() || additionalDeps.length() || objectName.size()) + else if(compileFlags.size() || additionalDeps.length() + || objectName.size()) { const char* aCompilerTool = "VCCLCompilerTool"; std::string ext = (*sf)->GetSourceExtension(); @@ -1119,7 +1153,8 @@ void cmLocalVisualStudio7Generator::WriteGroup(const cmSourceGroup *sg, cmTarget i != configs->end(); ++i) { fout << "\t\t\t\t<FileConfiguration\n" - << "\t\t\t\t\tName=\"" << *i << "|" << this->PlatformName << "\">\n" + << "\t\t\t\t\tName=\"" << *i + << "|" << this->PlatformName << "\">\n" << "\t\t\t\t\t<Tool\n" << "\t\t\t\t\tName=\"" << aCompilerTool << "\"\n"; if(compileFlags.size()) @@ -1171,7 +1206,9 @@ WriteCustomRule(std::ostream& fout, // Write the rule for each configuration. std::vector<std::string>::iterator i; std::vector<std::string> *configs = - static_cast<cmGlobalVisualStudio7Generator *>(this->GlobalGenerator)->GetConfigurations(); + static_cast<cmGlobalVisualStudio7Generator *> + (this->GlobalGenerator)->GetConfigurations(); + for(i = configs->begin(); i != configs->end(); ++i) { fout << "\t\t\t\t<FileConfiguration\n"; @@ -1185,8 +1222,10 @@ WriteCustomRule(std::ostream& fout, } fout << "\t\t\t\t\t<Tool\n" << "\t\t\t\t\tName=\"VCCustomBuildTool\"\n" - << "\t\t\t\t\tDescription=\"" << this->EscapeForXML(comment) << "\"\n" - << "\t\t\t\t\tCommandLine=\"" << this->EscapeForXML(command) << "\"\n" + << "\t\t\t\t\tDescription=\"" + << this->EscapeForXML(comment) << "\"\n" + << "\t\t\t\t\tCommandLine=\"" + << this->EscapeForXML(command) << "\"\n" << "\t\t\t\t\tAdditionalDependencies=\""; // Write out the dependencies for the rule. std::string temp; @@ -1238,9 +1277,10 @@ 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, - const char * /*libName*/) +void cmLocalVisualStudio7Generator +::OutputTargetRules(std::ostream& fout, + cmTarget &target, + const char * /*libName*/) { if (target.GetType() > cmTarget::GLOBAL_TARGET) { @@ -1259,7 +1299,8 @@ void cmLocalVisualStudio7Generator::OutputTargetRules(std::ostream& fout, fout << "\nCommandLine=\""; init = true; } - std::string script = this->ConstructScript(cr->GetCommandLines(), cr->GetWorkingDirectory()); + std::string script = + this->ConstructScript(cr->GetCommandLines(), cr->GetWorkingDirectory()); fout << this->EscapeForXML(script.c_str()).c_str(); } if (init) @@ -1302,7 +1343,8 @@ void cmLocalVisualStudio7Generator::OutputTargetRules(std::ostream& fout, fout << "\nCommandLine=\""; init = true; } - std::string script = this->ConstructScript(cr->GetCommandLines(), cr->GetWorkingDirectory()); + std::string script = + this->ConstructScript(cr->GetCommandLines(), cr->GetWorkingDirectory()); fout << this->EscapeForXML(script.c_str()).c_str(); } if (init) @@ -1381,7 +1423,8 @@ std::string cmLocalVisualStudio7Generator::EscapeForXML(const char* s) return ret; } -std::string cmLocalVisualStudio7Generator::ConvertToXMLOutputPath(const char* path) +std::string cmLocalVisualStudio7Generator +::ConvertToXMLOutputPath(const char* path) { std::string ret = this->ConvertToOptionallyRelativeOutputPath(path); cmSystemTools::ReplaceString(ret, "&", "&"); @@ -1391,7 +1434,8 @@ std::string cmLocalVisualStudio7Generator::ConvertToXMLOutputPath(const char* pa return ret; } -std::string cmLocalVisualStudio7Generator::ConvertToXMLOutputPathSingle(const char* path) +std::string cmLocalVisualStudio7Generator +::ConvertToXMLOutputPathSingle(const char* path) { std::string ret = this->ConvertToOptionallyRelativeOutputPath(path); cmSystemTools::ReplaceString(ret, "\"", ""); @@ -1426,7 +1470,8 @@ void cmLocalVisualStudio7Generator::ConfigureFinalPass() } //---------------------------------------------------------------------------- -std::string cmLocalVisualStudio7Generator::GetTargetDirectory(cmTarget& target) +std::string cmLocalVisualStudio7Generator +::GetTargetDirectory(cmTarget& target) { std::string dir; dir += target.GetName(); diff --git a/Source/cmLocalVisualStudio7Generator.h b/Source/cmLocalVisualStudio7Generator.h index d6cfe5a..22d5d0b 100644 --- a/Source/cmLocalVisualStudio7Generator.h +++ b/Source/cmLocalVisualStudio7Generator.h @@ -65,7 +65,8 @@ public: void SetPlatformName(const char* n) { this->PlatformName = n;} virtual void ConfigureFinalPass(); private: - void FillFlagMapFromCommandFlags(std::map<cmStdString, cmStdString>& flagMap, + void FillFlagMapFromCommandFlags(std::map<cmStdString, + cmStdString>& flagMap, cmVS7FlagTable* flagTable, std::string& flags); std::string GetBuildTypeLinkerFlags(std::string rootLinkerFlags, @@ -111,7 +112,8 @@ private: const std::vector<std::string>& outputs, const char* extraFlags); - void WriteGroup(const cmSourceGroup *sg, cmTarget target, std::ostream &fout, + void WriteGroup(const cmSourceGroup *sg, + cmTarget target, std::ostream &fout, const char *libName, std::vector<std::string> *configs); virtual std::string GetTargetDirectory(cmTarget&); |