summaryrefslogtreecommitdiff
path: root/Source/cmBuildCommand.cxx
diff options
context:
space:
mode:
authorKitware Robot <kwrobot@kitware.com>2016-05-16 10:34:04 -0400
committerBrad King <brad.king@kitware.com>2016-05-16 16:05:19 -0400
commitd9fd2f5402eeaa345691313658e02b51038f570b (patch)
treedca71b9a7e267f4c6300da3eb770415381726785 /Source/cmBuildCommand.cxx
parent82df6deaafb36cbbfd450202bb20b320f637751a (diff)
downloadcmake-d9fd2f5402eeaa345691313658e02b51038f570b.tar.gz
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/cmBuildCommand.cxx')
-rw-r--r--Source/cmBuildCommand.cxx117
1 files changed, 49 insertions, 68 deletions
diff --git a/Source/cmBuildCommand.cxx b/Source/cmBuildCommand.cxx
index b9183ed870..586e8a8114 100644
--- a/Source/cmBuildCommand.cxx
+++ b/Source/cmBuildCommand.cxx
@@ -13,27 +13,24 @@
#include "cmGlobalGenerator.h"
-bool cmBuildCommand
-::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &)
+bool cmBuildCommand::InitialPass(std::vector<std::string> const& args,
+ cmExecutionStatus&)
{
// Support the legacy signature of the command:
//
- if(2 == args.size())
- {
+ if (2 == args.size()) {
return this->TwoArgsSignature(args);
- }
+ }
return this->MainSignature(args);
}
-bool cmBuildCommand
-::MainSignature(std::vector<std::string> const& args)
+bool cmBuildCommand::MainSignature(std::vector<std::string> const& args)
{
- if(args.size() < 1)
- {
+ if (args.size() < 1) {
this->SetError("requires at least one argument naming a CMake variable");
return false;
- }
+ }
// The cmake variable in which to store the result.
const char* variable = args[0].c_str();
@@ -42,107 +39,91 @@ bool cmBuildCommand
const char* configuration = 0;
const char* project_name = 0;
std::string target;
- enum Doing { DoingNone, DoingConfiguration, DoingProjectName, DoingTarget };
+ enum Doing
+ {
+ DoingNone,
+ DoingConfiguration,
+ DoingProjectName,
+ DoingTarget
+ };
Doing doing = DoingNone;
- for(unsigned int i=1; i < args.size(); ++i)
- {
- if(args[i] == "CONFIGURATION")
- {
+ for (unsigned int i = 1; i < args.size(); ++i) {
+ if (args[i] == "CONFIGURATION") {
doing = DoingConfiguration;
- }
- else if(args[i] == "PROJECT_NAME")
- {
+ } else if (args[i] == "PROJECT_NAME") {
doing = DoingProjectName;
- }
- else if(args[i] == "TARGET")
- {
+ } else if (args[i] == "TARGET") {
doing = DoingTarget;
- }
- else if(doing == DoingConfiguration)
- {
+ } else if (doing == DoingConfiguration) {
doing = DoingNone;
configuration = args[i].c_str();
- }
- else if(doing == DoingProjectName)
- {
+ } else if (doing == DoingProjectName) {
doing = DoingNone;
project_name = args[i].c_str();
- }
- else if(doing == DoingTarget)
- {
+ } else if (doing == DoingTarget) {
doing = DoingNone;
target = args[i];
- }
- else
- {
+ } else {
std::ostringstream e;
e << "unknown argument \"" << args[i] << "\"";
this->SetError(e.str());
return false;
- }
}
+ }
// If null/empty CONFIGURATION argument, cmake --build uses 'Debug'
// in the currently implemented multi-configuration global generators...
// so we put this code here to end up with the same default configuration
// as the original 2-arg build_command signature:
//
- if(!configuration || !*configuration)
- {
+ if (!configuration || !*configuration) {
configuration = getenv("CMAKE_CONFIG_TYPE");
- }
- if(!configuration || !*configuration)
- {
+ }
+ if (!configuration || !*configuration) {
configuration = "Release";
- }
+ }
- if(project_name && *project_name)
- {
- this->Makefile->IssueMessage(cmake::AUTHOR_WARNING,
+ if (project_name && *project_name) {
+ this->Makefile->IssueMessage(
+ cmake::AUTHOR_WARNING,
"Ignoring PROJECT_NAME option because it has no effect.");
- }
+ }
- std::string makecommand = this->Makefile->GetGlobalGenerator()
- ->GenerateCMakeBuildCommand(target, configuration, "",
- this->Makefile->IgnoreErrorsCMP0061());
+ std::string makecommand =
+ this->Makefile->GetGlobalGenerator()->GenerateCMakeBuildCommand(
+ target, configuration, "", this->Makefile->IgnoreErrorsCMP0061());
this->Makefile->AddDefinition(variable, makecommand.c_str());
return true;
}
-bool cmBuildCommand
-::TwoArgsSignature(std::vector<std::string> const& args)
+bool cmBuildCommand::TwoArgsSignature(std::vector<std::string> const& args)
{
- if(args.size() < 2 )
- {
+ if (args.size() < 2) {
this->SetError("called with less than two arguments");
return false;
- }
+ }
const char* define = args[0].c_str();
- const char* cacheValue
- = this->Makefile->GetDefinition(define);
+ const char* cacheValue = this->Makefile->GetDefinition(define);
std::string configType = "Release";
const char* cfg = getenv("CMAKE_CONFIG_TYPE");
- if ( cfg && *cfg )
- {
+ if (cfg && *cfg) {
configType = cfg;
- }
+ }
- std::string makecommand = this->Makefile->GetGlobalGenerator()
- ->GenerateCMakeBuildCommand("", configType, "",
- this->Makefile->IgnoreErrorsCMP0061());
+ std::string makecommand =
+ this->Makefile->GetGlobalGenerator()->GenerateCMakeBuildCommand(
+ "", configType, "", this->Makefile->IgnoreErrorsCMP0061());
- if(cacheValue)
- {
+ if (cacheValue) {
return true;
- }
- this->Makefile->AddCacheDefinition(define,
- makecommand.c_str(),
- "Command used to build entire project "
- "from the command line.",
- cmState::STRING);
+ }
+ this->Makefile->AddCacheDefinition(define, makecommand.c_str(),
+ "Command used to build entire project "
+ "from the command line.",
+ cmState::STRING);
return true;
}