summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorDaniel Pfeifer <daniel@pfeifer-mail.de>2016-10-18 21:16:02 (GMT)
committerBrad King <brad.king@kitware.com>2016-10-20 12:48:20 (GMT)
commiteffa6c8343fb871574cb5471de5eb4c1705dd334 (patch)
tree9349fd3223bf5d9369e80eace97ad04209c52bd1 /Source
parentfb461cacba5afe98fd9871d4b8ab0500d825ad5a (diff)
downloadCMake-effa6c8343fb871574cb5471de5eb4c1705dd334.zip
CMake-effa6c8343fb871574cb5471de5eb4c1705dd334.tar.gz
CMake-effa6c8343fb871574cb5471de5eb4c1705dd334.tar.bz2
fix more issues reported by clang-tidy
Diffstat (limited to 'Source')
-rw-r--r--Source/CPack/IFW/cmCPackIFWInstaller.cxx2
-rw-r--r--Source/cmExtraCodeLiteGenerator.cxx10
-rw-r--r--Source/cmFileCommand.cxx54
-rw-r--r--Source/cmFileMonitor.cxx4
-rw-r--r--Source/cmGeneratorTarget.cxx2
-rw-r--r--Source/cmGetPropertyCommand.cxx2
-rw-r--r--Source/cmGetTargetPropertyCommand.cxx2
-rw-r--r--Source/cmNinjaTargetGenerator.cxx6
-rw-r--r--Source/cmServerProtocol.cxx22
-rw-r--r--Source/cmTarget.cxx12
-rw-r--r--Source/cmTargetPropertyComputer.h6
-rw-r--r--Source/cmcmd.cxx92
12 files changed, 131 insertions, 83 deletions
diff --git a/Source/CPack/IFW/cmCPackIFWInstaller.cxx b/Source/CPack/IFW/cmCPackIFWInstaller.cxx
index d9ac909..0098a4b 100644
--- a/Source/CPack/IFW/cmCPackIFWInstaller.cxx
+++ b/Source/CPack/IFW/cmCPackIFWInstaller.cxx
@@ -231,7 +231,7 @@ public:
protected:
void StartElement(const std::string& name, const char** /*atts*/) CM_OVERRIDE
{
- file = name == "file" ? true : false;
+ file = name == "file";
if (file) {
hasFiles = true;
}
diff --git a/Source/cmExtraCodeLiteGenerator.cxx b/Source/cmExtraCodeLiteGenerator.cxx
index 360c852..efce263 100644
--- a/Source/cmExtraCodeLiteGenerator.cxx
+++ b/Source/cmExtraCodeLiteGenerator.cxx
@@ -430,17 +430,19 @@ void cmExtraCodeLiteGenerator::CreateProjectSourceEntries(
xml.StartElement("General");
std::string outputPath = mf->GetSafeDefinition("EXECUTABLE_OUTPUT_PATH");
- if (!outputPath.empty())
+ if (!outputPath.empty()) {
xml.Attribute("OutputFile", outputPath + "/$(ProjectName)");
- else
+ } else {
xml.Attribute("OutputFile", "$(IntermediateDirectory)/$(ProjectName)");
+ }
xml.Attribute("IntermediateDirectory", "./");
xml.Attribute("Command", "./$(ProjectName)");
xml.Attribute("CommandArguments", "");
- if (!outputPath.empty())
+ if (!outputPath.empty()) {
xml.Attribute("WorkingDirectory", outputPath);
- else
+ } else {
xml.Attribute("WorkingDirectory", "$(IntermediateDirectory)");
+ }
xml.Attribute("PauseExecWhenProcTerminates", "yes");
xml.EndElement(); // General
diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx
index a71ff71..8dd204b 100644
--- a/Source/cmFileCommand.cxx
+++ b/Source/cmFileCommand.cxx
@@ -115,41 +115,59 @@ bool cmFileCommand::InitialPass(std::vector<std::string> const& args,
}
if (subCommand == "STRINGS") {
return this->HandleStringsCommand(args);
- } else if (subCommand == "GLOB") {
+ }
+ if (subCommand == "GLOB") {
return this->HandleGlobCommand(args, false);
- } else if (subCommand == "GLOB_RECURSE") {
+ }
+ if (subCommand == "GLOB_RECURSE") {
return this->HandleGlobCommand(args, true);
- } else if (subCommand == "MAKE_DIRECTORY") {
+ }
+ if (subCommand == "MAKE_DIRECTORY") {
return this->HandleMakeDirectoryCommand(args);
- } else if (subCommand == "RENAME") {
+ }
+ if (subCommand == "RENAME") {
return this->HandleRename(args);
- } else if (subCommand == "REMOVE") {
+ }
+ if (subCommand == "REMOVE") {
return this->HandleRemove(args, false);
- } else if (subCommand == "REMOVE_RECURSE") {
+ }
+ if (subCommand == "REMOVE_RECURSE") {
return this->HandleRemove(args, true);
- } else if (subCommand == "COPY") {
+ }
+ if (subCommand == "COPY") {
return this->HandleCopyCommand(args);
- } else if (subCommand == "INSTALL") {
+ }
+ if (subCommand == "INSTALL") {
return this->HandleInstallCommand(args);
- } else if (subCommand == "DIFFERENT") {
+ }
+ if (subCommand == "DIFFERENT") {
return this->HandleDifferentCommand(args);
- } else if (subCommand == "RPATH_CHANGE" || subCommand == "CHRPATH") {
+ }
+ if (subCommand == "RPATH_CHANGE" || subCommand == "CHRPATH") {
return this->HandleRPathChangeCommand(args);
- } else if (subCommand == "RPATH_CHECK") {
+ }
+ if (subCommand == "RPATH_CHECK") {
return this->HandleRPathCheckCommand(args);
- } else if (subCommand == "RPATH_REMOVE") {
+ }
+ if (subCommand == "RPATH_REMOVE") {
return this->HandleRPathRemoveCommand(args);
- } else if (subCommand == "RELATIVE_PATH") {
+ }
+ if (subCommand == "RELATIVE_PATH") {
return this->HandleRelativePathCommand(args);
- } else if (subCommand == "TO_CMAKE_PATH") {
+ }
+ if (subCommand == "TO_CMAKE_PATH") {
return this->HandleCMakePathCommand(args, false);
- } else if (subCommand == "TO_NATIVE_PATH") {
+ }
+ if (subCommand == "TO_NATIVE_PATH") {
return this->HandleCMakePathCommand(args, true);
- } else if (subCommand == "TIMESTAMP") {
+ }
+ if (subCommand == "TIMESTAMP") {
return this->HandleTimestampCommand(args);
- } else if (subCommand == "GENERATE") {
+ }
+ if (subCommand == "GENERATE") {
return this->HandleGenerateCommand(args);
- } else if (subCommand == "LOCK") {
+ }
+ if (subCommand == "LOCK") {
return this->HandleLockCommand(args);
}
diff --git a/Source/cmFileMonitor.cxx b/Source/cmFileMonitor.cxx
index 41ec8b4..b55341b 100644
--- a/Source/cmFileMonitor.cxx
+++ b/Source/cmFileMonitor.cxx
@@ -36,7 +36,7 @@ public:
class cmVirtualDirectoryWatcher : public cmIBaseWatcher
{
public:
- ~cmVirtualDirectoryWatcher()
+ ~cmVirtualDirectoryWatcher() override
{
for (auto i : this->Children) {
delete i.second;
@@ -156,7 +156,7 @@ public:
p->AddChildWatcher(ps, this);
}
- ~cmRealDirectoryWatcher()
+ ~cmRealDirectoryWatcher() override
{
// Handle is freed via uv_handle_close callback!
}
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index b16cfc6..9fa23c0 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -400,7 +400,7 @@ const char* cmGeneratorTarget::GetProperty(const std::string& prop) const
if (!cmTargetPropertyComputer::PassesWhitelist(
this->GetType(), prop, this->Makefile->GetMessenger(),
this->GetBacktrace())) {
- return 0;
+ return CM_NULLPTR;
}
if (const char* result = cmTargetPropertyComputer::GetProperty(
this, prop, this->Makefile->GetMessenger(), this->GetBacktrace())) {
diff --git a/Source/cmGetPropertyCommand.cxx b/Source/cmGetPropertyCommand.cxx
index 39445dd..9f64397 100644
--- a/Source/cmGetPropertyCommand.cxx
+++ b/Source/cmGetPropertyCommand.cxx
@@ -247,7 +247,7 @@ bool cmGetPropertyCommand::HandleTargetMode()
}
return this->StoreResult(CM_NULLPTR);
}
- const char* prop_cstr = 0;
+ const char* prop_cstr = CM_NULLPTR;
cmListFileBacktrace bt = this->Makefile->GetBacktrace();
cmMessenger* messenger = this->Makefile->GetMessenger();
if (cmTargetPropertyComputer::PassesWhitelist(
diff --git a/Source/cmGetTargetPropertyCommand.cxx b/Source/cmGetTargetPropertyCommand.cxx
index 6a816d8..e78f780 100644
--- a/Source/cmGetTargetPropertyCommand.cxx
+++ b/Source/cmGetTargetPropertyCommand.cxx
@@ -24,7 +24,7 @@ bool cmGetTargetPropertyCommand::InitialPass(
prop_exists = true;
}
} else if (!args[2].empty()) {
- const char* prop_cstr = 0;
+ const char* prop_cstr = CM_NULLPTR;
cmListFileBacktrace bt = this->Makefile->GetBacktrace();
cmMessenger* messenger = this->Makefile->GetMessenger();
if (cmTargetPropertyComputer::PassesWhitelist(tgt->GetType(), args[2],
diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx
index 1ac6cd4..ff4098b 100644
--- a/Source/cmNinjaTargetGenerator.cxx
+++ b/Source/cmNinjaTargetGenerator.cxx
@@ -274,8 +274,9 @@ std::string cmNinjaTargetGenerator::GetPreprocessedFilePath(
objName.substr(0, objName.size() - objExt.size()) + "-pp." + ppExt;
std::string path = this->LocalGenerator->GetHomeRelativeOutputPath();
- if (!path.empty())
+ if (!path.empty()) {
path += "/";
+ }
path += this->LocalGenerator->GetTargetDirectory(this->GeneratorTarget);
path += "/";
path += ppName;
@@ -286,8 +287,9 @@ std::string cmNinjaTargetGenerator::GetDyndepFilePath(
std::string const& lang) const
{
std::string path = this->LocalGenerator->GetHomeRelativeOutputPath();
- if (!path.empty())
+ if (!path.empty()) {
path += "/";
+ }
path += this->LocalGenerator->GetTargetDirectory(this->GeneratorTarget);
path += "/";
path += lang;
diff --git a/Source/cmServerProtocol.cxx b/Source/cmServerProtocol.cxx
index e0fcb75..84628d4 100644
--- a/Source/cmServerProtocol.cxx
+++ b/Source/cmServerProtocol.cxx
@@ -42,8 +42,9 @@ static std::vector<std::string> getConfigurations(const cmake* cm)
}
makefiles[0]->GetConfigurations(configurations);
- if (configurations.empty())
+ if (configurations.empty()) {
configurations.push_back("");
+ }
return configurations;
}
@@ -96,20 +97,24 @@ static void getCMakeInputs(const cmGlobalGenerator* gg,
if (!sourceDir.empty()) {
const std::string& relative =
cmSystemTools::RelativePath(sourceDir.c_str(), jt->c_str());
- if (toAdd.size() > relative.size())
+ if (toAdd.size() > relative.size()) {
toAdd = relative;
+ }
}
if (isInternal) {
- if (internalFiles)
+ if (internalFiles) {
internalFiles->push_back(toAdd);
+ }
} else {
if (isTemporary) {
- if (tmpFiles)
+ if (tmpFiles) {
tmpFiles->push_back(toAdd);
+ }
} else {
- if (explicitFiles)
+ if (explicitFiles) {
explicitFiles->push_back(toAdd);
+ }
}
}
}
@@ -672,8 +677,9 @@ static Json::Value DumpSourceFilesList(
Json::Value result = Json::arrayValue;
for (auto it = fileGroups.begin(); it != fileGroups.end(); ++it) {
Json::Value group = DumpSourceFileGroup(it->first, it->second, baseDir);
- if (!group.isNull())
+ if (!group.isNull()) {
result.append(group);
+ }
}
return result;
@@ -821,8 +827,8 @@ static Json::Value DumpProjectList(const cmake* cm, const std::string config)
Json::Value pObj = Json::objectValue;
pObj[kNAME_KEY] = projectIt.first;
- assert(projectIt.second.size() >
- 0); // All Projects must have at least one local generator
+ // All Projects must have at least one local generator
+ assert(!projectIt.second.empty());
const cmLocalGenerator* lg = projectIt.second.at(0);
// Project structure information:
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index 3a22309..de48193 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -852,13 +852,15 @@ void cmTarget::SetProperty(const std::string& prop, const char* value)
e << "NAME property is read-only\n";
this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str());
return;
- } else if (prop == "EXPORT_NAME" && this->IsImported()) {
+ }
+ if (prop == "EXPORT_NAME" && this->IsImported()) {
std::ostringstream e;
e << "EXPORT_NAME property can't be set on imported targets (\""
<< this->Name << "\")\n";
this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str());
return;
- } else if (prop == "SOURCES" && this->IsImported()) {
+ }
+ if (prop == "SOURCES" && this->IsImported()) {
std::ostringstream e;
e << "SOURCES property can't be set on imported targets (\"" << this->Name
<< "\")\n";
@@ -932,13 +934,15 @@ void cmTarget::AppendProperty(const std::string& prop, const char* value,
e << "NAME property is read-only\n";
this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str());
return;
- } else if (prop == "EXPORT_NAME" && this->IsImported()) {
+ }
+ if (prop == "EXPORT_NAME" && this->IsImported()) {
std::ostringstream e;
e << "EXPORT_NAME property can't be set on imported targets (\""
<< this->Name << "\")\n";
this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str());
return;
- } else if (prop == "SOURCES" && this->IsImported()) {
+ }
+ if (prop == "SOURCES" && this->IsImported()) {
std::ostringstream e;
e << "SOURCES property can't be set on imported targets (\"" << this->Name
<< "\")\n";
diff --git a/Source/cmTargetPropertyComputer.h b/Source/cmTargetPropertyComputer.h
index ed9a4e2..1f7150a 100644
--- a/Source/cmTargetPropertyComputer.h
+++ b/Source/cmTargetPropertyComputer.h
@@ -75,7 +75,7 @@ private:
}
// Support "LOCATION_<CONFIG>".
- else if (cmHasLiteralPrefix(prop, "LOCATION_")) {
+ if (cmHasLiteralPrefix(prop, "LOCATION_")) {
if (!tgt->IsImported() &&
!HandleLocationPropertyPolicy(tgt->GetName(), messenger,
context)) {
@@ -86,8 +86,8 @@ private:
}
// Support "<CONFIG>_LOCATION".
- else if (cmHasLiteralSuffix(prop, "_LOCATION") &&
- !cmHasLiteralPrefix(prop, "XCODE_ATTRIBUTE_")) {
+ if (cmHasLiteralSuffix(prop, "_LOCATION") &&
+ !cmHasLiteralPrefix(prop, "XCODE_ATTRIBUTE_")) {
std::string configName(prop.c_str(), prop.size() - 9);
if (configName != "IMPORTED") {
if (!tgt->IsImported() &&
diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx
index 4387bf6..b878534 100644
--- a/Source/cmcmd.cxx
+++ b/Source/cmcmd.cxx
@@ -414,7 +414,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
return 0;
}
- else if (args[1] == "env") {
+ if (args[1] == "env") {
std::vector<std::string>::const_iterator ai = args.begin() + 2;
std::vector<std::string>::const_iterator ae = args.end();
for (; ai != ae; ++ai) {
@@ -454,7 +454,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
}
#if defined(CMAKE_BUILD_WITH_CMAKE)
- else if (args[1] == "environment") {
+ if (args[1] == "environment") {
std::vector<std::string> env = cmSystemTools::GetEnvironmentVariables();
std::vector<std::string>::iterator it;
for (it = env.begin(); it != env.end(); ++it) {
@@ -464,7 +464,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
}
#endif
- else if (args[1] == "make_directory" && args.size() > 2) {
+ if (args[1] == "make_directory" && args.size() > 2) {
// If error occurs we want to continue copying next files.
bool return_value = 0;
for (std::string::size_type cc = 2; cc < args.size(); cc++) {
@@ -476,7 +476,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
return return_value;
}
- else if (args[1] == "remove_directory" && args.size() == 3) {
+ if (args[1] == "remove_directory" && args.size() == 3) {
if (cmSystemTools::FileIsDirectory(args[2]) &&
!cmSystemTools::RemoveADirectory(args[2])) {
std::cerr << "Error removing directory \"" << args[2] << "\".\n";
@@ -486,7 +486,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
}
// Remove file
- else if (args[1] == "remove" && args.size() > 2) {
+ if (args[1] == "remove" && args.size() > 2) {
bool force = false;
for (std::string::size_type cc = 2; cc < args.size(); cc++) {
if (args[cc] == "\\-f" || args[cc] == "-f") {
@@ -502,8 +502,9 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
}
return 0;
}
+
// Touch file
- else if (args[1] == "touch" && args.size() > 2) {
+ if (args[1] == "touch" && args.size() > 2) {
for (std::string::size_type cc = 2; cc < args.size(); cc++) {
if (!cmSystemTools::Touch(args[cc], true)) {
return 1;
@@ -511,8 +512,9 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
}
return 0;
}
+
// Touch file
- else if (args[1] == "touch_nocreate" && args.size() > 2) {
+ if (args[1] == "touch_nocreate" && args.size() > 2) {
for (std::string::size_type cc = 2; cc < args.size(); cc++) {
// Complain if the file could not be removed, still exists,
// and the -f option was not given.
@@ -522,8 +524,9 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
}
return 0;
}
+
// capabilities
- else if (args[1] == "capabilities") {
+ if (args[1] == "capabilities") {
if (args.size() > 2) {
std::cerr << "-E capabilities accepts no additional arguments\n";
return 1;
@@ -538,7 +541,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
}
// Sleep command
- else if (args[1] == "sleep" && args.size() > 2) {
+ if (args[1] == "sleep" && args.size() > 2) {
double total = 0;
for (size_t i = 2; i < args.size(); ++i) {
double num = 0.0;
@@ -559,7 +562,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
}
// Clock command
- else if (args[1] == "time" && args.size() > 2) {
+ if (args[1] == "time" && args.size() > 2) {
std::vector<std::string> command(args.begin() + 2, args.end());
clock_t clock_start, clock_finish;
@@ -583,8 +586,9 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
<< "\n";
return ret;
}
+
// Command to calculate the md5sum of a file
- else if (args[1] == "md5sum" && args.size() >= 3) {
+ if (args[1] == "md5sum" && args.size() >= 3) {
char md5out[32];
int retval = 0;
for (std::string::size_type cc = 2; cc < args.size(); cc++) {
@@ -606,7 +610,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
}
// Command to change directory and run a program.
- else if (args[1] == "chdir" && args.size() >= 4) {
+ if (args[1] == "chdir" && args.size() >= 4) {
std::string directory = args[2];
if (!cmSystemTools::FileExists(directory.c_str())) {
cmSystemTools::Error("Directory does not exist for chdir command: ",
@@ -628,7 +632,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
}
// Command to start progress for a build
- else if (args[1] == "cmake_progress_start" && args.size() == 4) {
+ if (args[1] == "cmake_progress_start" && args.size() == 4) {
// basically remove the directory
std::string dirName = args[2];
dirName += "/Progress";
@@ -660,7 +664,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
}
// Command to report progress for a build
- else if (args[1] == "cmake_progress_report" && args.size() >= 3) {
+ if (args[1] == "cmake_progress_report" && args.size() >= 3) {
// This has been superseded by cmake_echo_color --progress-*
// options. We leave it here to avoid errors if somehow this
// is invoked by an existing makefile without regenerating.
@@ -669,7 +673,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
// Command to create a symbolic link. Fails on platforms not
// supporting them.
- else if (args[1] == "create_symlink" && args.size() == 4) {
+ if (args[1] == "create_symlink" && args.size() == 4) {
const char* destinationFileName = args[3].c_str();
if ((cmSystemTools::FileExists(destinationFileName) ||
cmSystemTools::FileIsSymlink(destinationFileName)) &&
@@ -690,16 +694,17 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
}
// Internal CMake shared library support.
- else if (args[1] == "cmake_symlink_library" && args.size() == 5) {
+ if (args[1] == "cmake_symlink_library" && args.size() == 5) {
return cmcmd::SymlinkLibrary(args);
}
+
// Internal CMake versioned executable support.
- else if (args[1] == "cmake_symlink_executable" && args.size() == 4) {
+ if (args[1] == "cmake_symlink_executable" && args.size() == 4) {
return cmcmd::SymlinkExecutable(args);
}
// Internal CMake dependency scanning support.
- else if (args[1] == "cmake_depends" && args.size() >= 6) {
+ if (args[1] == "cmake_depends" && args.size() >= 6) {
const bool verbose = isCMakeVerbose();
// Create a cmake object instance to process dependencies.
@@ -774,41 +779,47 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
}
// Internal CMake link script support.
- else if (args[1] == "cmake_link_script" && args.size() >= 3) {
+ if (args[1] == "cmake_link_script" && args.size() >= 3) {
return cmcmd::ExecuteLinkScript(args);
}
#ifdef CMAKE_BUILD_WITH_CMAKE
// Internal CMake ninja dependency scanning support.
- else if (args[1] == "cmake_ninja_depends") {
+ if (args[1] == "cmake_ninja_depends") {
return cmcmd_cmake_ninja_depends(args.begin() + 2, args.end());
}
// Internal CMake ninja dyndep support.
- else if (args[1] == "cmake_ninja_dyndep") {
+ if (args[1] == "cmake_ninja_dyndep") {
return cmcmd_cmake_ninja_dyndep(args.begin() + 2, args.end());
}
#endif
// Internal CMake unimplemented feature notification.
- else if (args[1] == "cmake_unimplemented_variable") {
+ if (args[1] == "cmake_unimplemented_variable") {
std::cerr << "Feature not implemented for this platform.";
if (args.size() == 3) {
std::cerr << " Variable " << args[2] << " is not set.";
}
std::cerr << std::endl;
return 1;
- } else if (args[1] == "vs_link_exe") {
+ }
+
+ if (args[1] == "vs_link_exe") {
return cmcmd::VisualStudioLink(args, 1);
- } else if (args[1] == "vs_link_dll") {
+ }
+
+ if (args[1] == "vs_link_dll") {
return cmcmd::VisualStudioLink(args, 2);
}
+
// Internal CMake color makefile support.
- else if (args[1] == "cmake_echo_color") {
+ if (args[1] == "cmake_echo_color") {
return cmcmd::ExecuteEchoColor(args);
}
+
#ifdef CMAKE_BUILD_WITH_CMAKE
- else if (args[1] == "cmake_autogen" && args.size() >= 4) {
+ if (args[1] == "cmake_autogen" && args.size() >= 4) {
cmQtAutoGenerators autogen;
std::string const& config = args[3];
bool autogenSuccess = autogen.Run(args[2], config);
@@ -817,7 +828,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
#endif
// Tar files
- else if (args[1] == "tar" && args.size() > 3) {
+ if (args[1] == "tar" && args.size() > 3) {
const char* knownFormats[] = { "7zip", "gnutar", "pax", "paxr", "zip" };
std::string flags = args[2];
@@ -921,7 +932,9 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
#endif
}
return 0;
- } else if (args[1] == "server") {
+ }
+
+ if (args[1] == "server") {
const std::string pipePrefix = "--pipe=";
bool supportExperimental = false;
bool isDebug = false;
@@ -958,28 +971,26 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
std::string errorMessage;
if (server.Serve(&errorMessage)) {
return 0;
- } else {
- cmSystemTools::Error(errorMessage.c_str());
- return 1;
}
+ cmSystemTools::Error(errorMessage.c_str());
#else
static_cast<void>(supportExperimental);
static_cast<void>(isDebug);
cmSystemTools::Error("CMake was not built with server mode enabled");
- return 1;
#endif
+ return 1;
}
#if defined(CMAKE_BUILD_WITH_CMAKE)
// Internal CMake Fortran module support.
- else if (args[1] == "cmake_copy_f90_mod" && args.size() >= 4) {
+ if (args[1] == "cmake_copy_f90_mod" && args.size() >= 4) {
return cmDependsFortran::CopyModule(args) ? 0 : 1;
}
#endif
#if defined(_WIN32) && !defined(__CYGWIN__)
// Write registry value
- else if (args[1] == "write_regv" && args.size() > 3) {
+ if (args[1] == "write_regv" && args.size() > 3) {
return cmSystemTools::WriteRegistryValue(args[2].c_str(),
args[3].c_str())
? 0
@@ -987,16 +998,21 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
}
// Delete registry value
- else if (args[1] == "delete_regv" && args.size() > 2) {
+ if (args[1] == "delete_regv" && args.size() > 2) {
return cmSystemTools::DeleteRegistryValue(args[2].c_str()) ? 0 : 1;
}
+
// Remove file
- else if (args[1] == "comspec" && args.size() > 2) {
+ if (args[1] == "comspec" && args.size() > 2) {
std::cerr << "Win9x helper \"cmake -E comspec\" no longer supported\n";
return 1;
- } else if (args[1] == "env_vs8_wince" && args.size() == 3) {
+ }
+
+ if (args[1] == "env_vs8_wince" && args.size() == 3) {
return cmcmd::WindowsCEEnvironment("8.0", args[2]);
- } else if (args[1] == "env_vs9_wince" && args.size() == 3) {
+ }
+
+ if (args[1] == "env_vs9_wince" && args.size() == 3) {
return cmcmd::WindowsCEEnvironment("9.0", args[2]);
}
#endif