diff options
author | Kitware Robot <kwrobot@kitware.com> | 2016-05-16 14:34:04 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2016-05-16 20:05:19 (GMT) |
commit | d9fd2f5402eeaa345691313658e02b51038f570b (patch) | |
tree | dca71b9a7e267f4c6300da3eb770415381726785 /Source/cmTargetPropCommandBase.cxx | |
parent | 82df6deaafb36cbbfd450202bb20b320f637751a (diff) | |
download | CMake-d9fd2f5402eeaa345691313658e02b51038f570b.zip CMake-d9fd2f5402eeaa345691313658e02b51038f570b.tar.gz CMake-d9fd2f5402eeaa345691313658e02b51038f570b.tar.bz2 |
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.
Diffstat (limited to 'Source/cmTargetPropCommandBase.cxx')
-rw-r--r-- | Source/cmTargetPropCommandBase.cxx | 157 |
1 files changed, 64 insertions, 93 deletions
diff --git a/Source/cmTargetPropCommandBase.cxx b/Source/cmTargetPropCommandBase.cxx index 0c51b71..487074f 100644 --- a/Source/cmTargetPropCommandBase.cxx +++ b/Source/cmTargetPropCommandBase.cxx @@ -14,164 +14,135 @@ #include "cmGlobalGenerator.h" -bool cmTargetPropCommandBase -::HandleArguments(std::vector<std::string> const& args, - const std::string& prop, - ArgumentFlags flags) +bool cmTargetPropCommandBase::HandleArguments( + std::vector<std::string> const& args, const std::string& prop, + ArgumentFlags flags) { - if(args.size() < 2) - { + if (args.size() < 2) { this->SetError("called with incorrect number of arguments"); return false; - } + } // Lookup the target for which libraries are specified. - if (this->Makefile->IsAlias(args[0])) - { + if (this->Makefile->IsAlias(args[0])) { this->SetError("can not be used on an ALIAS target."); return false; - } + } this->Target = - this->Makefile->GetCMakeInstance() - ->GetGlobalGenerator()->FindTarget(args[0]); - if(!this->Target) - { + this->Makefile->GetCMakeInstance()->GetGlobalGenerator()->FindTarget( + args[0]); + if (!this->Target) { this->Target = this->Makefile->FindTargetToUse(args[0]); - } - if(!this->Target) - { + } + if (!this->Target) { this->HandleMissingTarget(args[0]); return false; - } - if ((this->Target->GetType() != cmState::SHARED_LIBRARY) - && (this->Target->GetType() != cmState::STATIC_LIBRARY) - && (this->Target->GetType() != cmState::OBJECT_LIBRARY) - && (this->Target->GetType() != cmState::MODULE_LIBRARY) - && (this->Target->GetType() != cmState::INTERFACE_LIBRARY) - && (this->Target->GetType() != cmState::EXECUTABLE)) - { + } + if ((this->Target->GetType() != cmState::SHARED_LIBRARY) && + (this->Target->GetType() != cmState::STATIC_LIBRARY) && + (this->Target->GetType() != cmState::OBJECT_LIBRARY) && + (this->Target->GetType() != cmState::MODULE_LIBRARY) && + (this->Target->GetType() != cmState::INTERFACE_LIBRARY) && + (this->Target->GetType() != cmState::EXECUTABLE)) { this->SetError("called with non-compilable target type"); return false; - } + } bool system = false; unsigned int argIndex = 1; - if ((flags & PROCESS_SYSTEM) && args[argIndex] == "SYSTEM") - { - if (args.size() < 3) - { + if ((flags & PROCESS_SYSTEM) && args[argIndex] == "SYSTEM") { + if (args.size() < 3) { this->SetError("called with incorrect number of arguments"); return false; - } + } system = true; ++argIndex; - } + } bool prepend = false; - if ((flags & PROCESS_BEFORE) && args[argIndex] == "BEFORE") - { - if (args.size() < 3) - { + if ((flags & PROCESS_BEFORE) && args[argIndex] == "BEFORE") { + if (args.size() < 3) { this->SetError("called with incorrect number of arguments"); return false; - } + } prepend = true; ++argIndex; - } + } this->Property = prop; - while (argIndex < args.size()) - { - if (!this->ProcessContentArgs(args, argIndex, prepend, system)) - { + while (argIndex < args.size()) { + if (!this->ProcessContentArgs(args, argIndex, prepend, system)) { return false; - } } + } return true; } -bool cmTargetPropCommandBase -::ProcessContentArgs(std::vector<std::string> const& args, - unsigned int &argIndex, bool prepend, bool system) +bool cmTargetPropCommandBase::ProcessContentArgs( + std::vector<std::string> const& args, unsigned int& argIndex, bool prepend, + bool system) { const std::string scope = args[argIndex]; - if(scope != "PUBLIC" - && scope != "PRIVATE" - && scope != "INTERFACE" ) - { + if (scope != "PUBLIC" && scope != "PRIVATE" && scope != "INTERFACE") { this->SetError("called with invalid arguments"); return false; - } + } - if(this->Target->IsImported()) - { + if (this->Target->IsImported()) { this->HandleImportedTarget(args[0]); return false; - } + } - if (this->Target->GetType() == cmState::INTERFACE_LIBRARY - && scope != "INTERFACE") - { + if (this->Target->GetType() == cmState::INTERFACE_LIBRARY && + scope != "INTERFACE") { this->SetError("may only be set INTERFACE properties on INTERFACE " - "targets"); + "targets"); return false; - } + } ++argIndex; std::vector<std::string> content; - for(unsigned int i=argIndex; i < args.size(); ++i, ++argIndex) - { - if(args[i] == "PUBLIC" - || args[i] == "PRIVATE" - || args[i] == "INTERFACE" ) - { + for (unsigned int i = argIndex; i < args.size(); ++i, ++argIndex) { + if (args[i] == "PUBLIC" || args[i] == "PRIVATE" || + args[i] == "INTERFACE") { return this->PopulateTargetProperies(scope, content, prepend, system); - } - content.push_back(args[i]); } + content.push_back(args[i]); + } return this->PopulateTargetProperies(scope, content, prepend, system); } -bool cmTargetPropCommandBase -::PopulateTargetProperies(const std::string &scope, - const std::vector<std::string> &content, - bool prepend, bool system) +bool cmTargetPropCommandBase::PopulateTargetProperies( + const std::string& scope, const std::vector<std::string>& content, + bool prepend, bool system) { - if (scope == "PRIVATE" || scope == "PUBLIC") - { - if (!this->HandleDirectContent(this->Target, content, prepend, system)) - { + if (scope == "PRIVATE" || scope == "PUBLIC") { + if (!this->HandleDirectContent(this->Target, content, prepend, system)) { return false; - } } - if (scope == "INTERFACE" || scope == "PUBLIC") - { + } + if (scope == "INTERFACE" || scope == "PUBLIC") { this->HandleInterfaceContent(this->Target, content, prepend, system); - } + } return true; } -void cmTargetPropCommandBase::HandleInterfaceContent(cmTarget *tgt, - const std::vector<std::string> &content, - bool prepend, bool) +void cmTargetPropCommandBase::HandleInterfaceContent( + cmTarget* tgt, const std::vector<std::string>& content, bool prepend, bool) { - if (prepend) - { + if (prepend) { const std::string propName = std::string("INTERFACE_") + this->Property; - const char *propValue = tgt->GetProperty(propName); - const std::string totalContent = this->Join(content) + (propValue - ? std::string(";") + propValue - : std::string()); + const char* propValue = tgt->GetProperty(propName); + const std::string totalContent = this->Join(content) + + (propValue ? std::string(";") + propValue : std::string()); tgt->SetProperty(propName, totalContent.c_str()); - } - else - { + } else { tgt->AppendProperty("INTERFACE_" + this->Property, - this->Join(content).c_str()); - } + this->Join(content).c_str()); + } } |