From d9fd2f5402eeaa345691313658e02b51038f570b Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Mon, 16 May 2016 10:34:04 -0400 Subject: Revise C++ coding style using clang-format Run the `Utilities/Scripts/clang-format.bash` script to update all our C++ code to a new style defined by `.clang-format`. Use `clang-format` version 3.8. * If you reached this commit for a line in `git blame`, re-run the blame operation starting at the parent of this commit to see older history for the content. * See the parent commit for instructions to rebase a change across this style transition commit. --- Source/cmExportLibraryDependenciesCommand.cxx | 125 +++++++++++--------------- 1 file changed, 51 insertions(+), 74 deletions(-) (limited to 'Source/cmExportLibraryDependenciesCommand.cxx') diff --git a/Source/cmExportLibraryDependenciesCommand.cxx b/Source/cmExportLibraryDependenciesCommand.cxx index a715070203..ab43aa8a58 100644 --- a/Source/cmExportLibraryDependenciesCommand.cxx +++ b/Source/cmExportLibraryDependenciesCommand.cxx @@ -18,33 +18,31 @@ #include -bool cmExportLibraryDependenciesCommand -::InitialPass(std::vector const& args, cmExecutionStatus &) +bool cmExportLibraryDependenciesCommand::InitialPass( + std::vector const& args, cmExecutionStatus&) { - if(this->Disallowed(cmPolicies::CMP0033, - "The export_library_dependencies command should not be called; " - "see CMP0033.")) - { return true; } - if(args.size() < 1 ) - { + if (this->Disallowed( + cmPolicies::CMP0033, + "The export_library_dependencies command should not be called; " + "see CMP0033.")) { + return true; + } + if (args.size() < 1) { this->SetError("called with incorrect number of arguments"); return false; - } + } // store the arguments for the final pass this->Filename = args[0]; this->Append = false; - if(args.size() > 1) - { - if(args[1] == "APPEND") - { + if (args.size() > 1) { + if (args[1] == "APPEND") { this->Append = true; - } } + } return true; } - void cmExportLibraryDependenciesCommand::FinalPass() { // export_library_dependencies() shouldn't modify anything @@ -56,27 +54,23 @@ void cmExportLibraryDependenciesCommand::ConstFinalPass() const { // Use copy-if-different if not appending. cmsys::auto_ptr foutPtr; - if(this->Append) - { + if (this->Append) { cmsys::auto_ptr ap( new cmsys::ofstream(this->Filename.c_str(), std::ios::app)); foutPtr = ap; - } - else - { + } else { cmsys::auto_ptr ap( new cmGeneratedFileStream(this->Filename.c_str(), true)); ap->SetCopyIfDifferent(true); foutPtr = ap; - } + } std::ostream& fout = *foutPtr.get(); - if (!fout) - { + if (!fout) { cmSystemTools::Error("Error Writing ", this->Filename.c_str()); cmSystemTools::ReportLastSystemError(""); return; - } + } // Collect dependency information about all library targets built in // the project. @@ -86,22 +80,18 @@ void cmExportLibraryDependenciesCommand::ConstFinalPass() const std::map libDepsOld; std::map libDepsNew; std::map libTypes; - for(std::vector::const_iterator i = locals.begin(); - i != locals.end(); ++i) - { - const cmTargets &tgts = (*i)->GetTargets(); - for(cmTargets::const_iterator l = tgts.begin(); - l != tgts.end(); ++l) - { + for (std::vector::const_iterator i = locals.begin(); + i != locals.end(); ++i) { + const cmTargets& tgts = (*i)->GetTargets(); + for (cmTargets::const_iterator l = tgts.begin(); l != tgts.end(); ++l) { // Get the current target. cmTarget const& target = l->second; // Skip non-library targets. - if(target.GetType() < cmState::STATIC_LIBRARY - || target.GetType() > cmState::MODULE_LIBRARY) - { + if (target.GetType() < cmState::STATIC_LIBRARY || + target.GetType() > cmState::MODULE_LIBRARY) { continue; - } + } // Construct the dependency variable name. std::string targetEntry = target.GetName(); @@ -113,14 +103,12 @@ void cmExportLibraryDependenciesCommand::ConstFinalPass() const std::string valueNew; cmTarget::LinkLibraryVectorType const& libs = target.GetOriginalLinkLibraries(); - for(cmTarget::LinkLibraryVectorType::const_iterator li = libs.begin(); - li != libs.end(); ++li) - { + for (cmTarget::LinkLibraryVectorType::const_iterator li = libs.begin(); + li != libs.end(); ++li) { std::string ltVar = li->first; ltVar += "_LINK_TYPE"; std::string ltValue; - switch(li->second) - { + switch (li->second) { case GENERAL_LibraryType: valueNew += "general;"; ltValue = "general"; @@ -133,73 +121,62 @@ void cmExportLibraryDependenciesCommand::ConstFinalPass() const valueNew += "optimized;"; ltValue = "optimized"; break; - } + } std::string lib = li->first; - if(cmTarget* libtgt = global->FindTarget(lib)) - { + if (cmTarget* libtgt = global->FindTarget(lib)) { // Handle simple output name changes. This command is // deprecated so we do not support full target name // translation (which requires per-configuration info). - if(const char* outname = libtgt->GetProperty("OUTPUT_NAME")) - { + if (const char* outname = libtgt->GetProperty("OUTPUT_NAME")) { lib = outname; - } } + } valueOld += lib; valueOld += ";"; valueNew += lib; valueNew += ";"; std::string& ltEntry = libTypes[ltVar]; - if(ltEntry.empty()) - { + if (ltEntry.empty()) { ltEntry = ltValue; - } - else if(ltEntry != ltValue) - { + } else if (ltEntry != ltValue) { ltEntry = "general"; - } } + } libDepsNew[targetEntry] = valueNew; libDepsOld[targetEntry] = valueOld; - } } + } // Generate dependency information for both old and new style CMake // versions. const char* vertest = "\"${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}\" GREATER 2.4"; - fout << "# Generated by CMake " << cmVersion::GetCMakeVersion() << "\n\n"; + fout << "# Generated by CMake " << cmVersion::GetCMakeVersion() << "\n\n"; fout << "if(" << vertest << ")\n"; fout << " # Information for CMake 2.6 and above.\n"; - for(std::map::const_iterator - i = libDepsNew.begin(); - i != libDepsNew.end(); ++i) - { - if(!i->second.empty()) - { + for (std::map::const_iterator i = + libDepsNew.begin(); + i != libDepsNew.end(); ++i) { + if (!i->second.empty()) { fout << " set(\"" << i->first << "\" \"" << i->second << "\")\n"; - } } + } fout << "else()\n"; fout << " # Information for CMake 2.4 and lower.\n"; - for(std::map::const_iterator - i = libDepsOld.begin(); - i != libDepsOld.end(); ++i) - { - if(!i->second.empty()) - { + for (std::map::const_iterator i = + libDepsOld.begin(); + i != libDepsOld.end(); ++i) { + if (!i->second.empty()) { fout << " set(\"" << i->first << "\" \"" << i->second << "\")\n"; - } } - for(std::map::const_iterator i = libTypes.begin(); - i != libTypes.end(); ++i) - { - if(i->second != "general") - { + } + for (std::map::const_iterator i = libTypes.begin(); + i != libTypes.end(); ++i) { + if (i->second != "general") { fout << " set(\"" << i->first << "\" \"" << i->second << "\")\n"; - } } + } fout << "endif()\n"; return; } -- cgit v1.2.1