mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-05 05:11:15 -06:00
fix more issues reported by clang-tidy
This commit is contained in:
committed by
Brad King
parent
fb461cacba
commit
effa6c8343
@@ -231,7 +231,7 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
void StartElement(const std::string& name, const char** /*atts*/) CM_OVERRIDE
|
void StartElement(const std::string& name, const char** /*atts*/) CM_OVERRIDE
|
||||||
{
|
{
|
||||||
file = name == "file" ? true : false;
|
file = name == "file";
|
||||||
if (file) {
|
if (file) {
|
||||||
hasFiles = true;
|
hasFiles = true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -430,17 +430,19 @@ void cmExtraCodeLiteGenerator::CreateProjectSourceEntries(
|
|||||||
|
|
||||||
xml.StartElement("General");
|
xml.StartElement("General");
|
||||||
std::string outputPath = mf->GetSafeDefinition("EXECUTABLE_OUTPUT_PATH");
|
std::string outputPath = mf->GetSafeDefinition("EXECUTABLE_OUTPUT_PATH");
|
||||||
if (!outputPath.empty())
|
if (!outputPath.empty()) {
|
||||||
xml.Attribute("OutputFile", outputPath + "/$(ProjectName)");
|
xml.Attribute("OutputFile", outputPath + "/$(ProjectName)");
|
||||||
else
|
} else {
|
||||||
xml.Attribute("OutputFile", "$(IntermediateDirectory)/$(ProjectName)");
|
xml.Attribute("OutputFile", "$(IntermediateDirectory)/$(ProjectName)");
|
||||||
|
}
|
||||||
xml.Attribute("IntermediateDirectory", "./");
|
xml.Attribute("IntermediateDirectory", "./");
|
||||||
xml.Attribute("Command", "./$(ProjectName)");
|
xml.Attribute("Command", "./$(ProjectName)");
|
||||||
xml.Attribute("CommandArguments", "");
|
xml.Attribute("CommandArguments", "");
|
||||||
if (!outputPath.empty())
|
if (!outputPath.empty()) {
|
||||||
xml.Attribute("WorkingDirectory", outputPath);
|
xml.Attribute("WorkingDirectory", outputPath);
|
||||||
else
|
} else {
|
||||||
xml.Attribute("WorkingDirectory", "$(IntermediateDirectory)");
|
xml.Attribute("WorkingDirectory", "$(IntermediateDirectory)");
|
||||||
|
}
|
||||||
xml.Attribute("PauseExecWhenProcTerminates", "yes");
|
xml.Attribute("PauseExecWhenProcTerminates", "yes");
|
||||||
xml.EndElement(); // General
|
xml.EndElement(); // General
|
||||||
|
|
||||||
|
|||||||
@@ -115,41 +115,59 @@ bool cmFileCommand::InitialPass(std::vector<std::string> const& args,
|
|||||||
}
|
}
|
||||||
if (subCommand == "STRINGS") {
|
if (subCommand == "STRINGS") {
|
||||||
return this->HandleStringsCommand(args);
|
return this->HandleStringsCommand(args);
|
||||||
} else if (subCommand == "GLOB") {
|
}
|
||||||
|
if (subCommand == "GLOB") {
|
||||||
return this->HandleGlobCommand(args, false);
|
return this->HandleGlobCommand(args, false);
|
||||||
} else if (subCommand == "GLOB_RECURSE") {
|
}
|
||||||
|
if (subCommand == "GLOB_RECURSE") {
|
||||||
return this->HandleGlobCommand(args, true);
|
return this->HandleGlobCommand(args, true);
|
||||||
} else if (subCommand == "MAKE_DIRECTORY") {
|
}
|
||||||
|
if (subCommand == "MAKE_DIRECTORY") {
|
||||||
return this->HandleMakeDirectoryCommand(args);
|
return this->HandleMakeDirectoryCommand(args);
|
||||||
} else if (subCommand == "RENAME") {
|
}
|
||||||
|
if (subCommand == "RENAME") {
|
||||||
return this->HandleRename(args);
|
return this->HandleRename(args);
|
||||||
} else if (subCommand == "REMOVE") {
|
}
|
||||||
|
if (subCommand == "REMOVE") {
|
||||||
return this->HandleRemove(args, false);
|
return this->HandleRemove(args, false);
|
||||||
} else if (subCommand == "REMOVE_RECURSE") {
|
}
|
||||||
|
if (subCommand == "REMOVE_RECURSE") {
|
||||||
return this->HandleRemove(args, true);
|
return this->HandleRemove(args, true);
|
||||||
} else if (subCommand == "COPY") {
|
}
|
||||||
|
if (subCommand == "COPY") {
|
||||||
return this->HandleCopyCommand(args);
|
return this->HandleCopyCommand(args);
|
||||||
} else if (subCommand == "INSTALL") {
|
}
|
||||||
|
if (subCommand == "INSTALL") {
|
||||||
return this->HandleInstallCommand(args);
|
return this->HandleInstallCommand(args);
|
||||||
} else if (subCommand == "DIFFERENT") {
|
}
|
||||||
|
if (subCommand == "DIFFERENT") {
|
||||||
return this->HandleDifferentCommand(args);
|
return this->HandleDifferentCommand(args);
|
||||||
} else if (subCommand == "RPATH_CHANGE" || subCommand == "CHRPATH") {
|
}
|
||||||
|
if (subCommand == "RPATH_CHANGE" || subCommand == "CHRPATH") {
|
||||||
return this->HandleRPathChangeCommand(args);
|
return this->HandleRPathChangeCommand(args);
|
||||||
} else if (subCommand == "RPATH_CHECK") {
|
}
|
||||||
|
if (subCommand == "RPATH_CHECK") {
|
||||||
return this->HandleRPathCheckCommand(args);
|
return this->HandleRPathCheckCommand(args);
|
||||||
} else if (subCommand == "RPATH_REMOVE") {
|
}
|
||||||
|
if (subCommand == "RPATH_REMOVE") {
|
||||||
return this->HandleRPathRemoveCommand(args);
|
return this->HandleRPathRemoveCommand(args);
|
||||||
} else if (subCommand == "RELATIVE_PATH") {
|
}
|
||||||
|
if (subCommand == "RELATIVE_PATH") {
|
||||||
return this->HandleRelativePathCommand(args);
|
return this->HandleRelativePathCommand(args);
|
||||||
} else if (subCommand == "TO_CMAKE_PATH") {
|
}
|
||||||
|
if (subCommand == "TO_CMAKE_PATH") {
|
||||||
return this->HandleCMakePathCommand(args, false);
|
return this->HandleCMakePathCommand(args, false);
|
||||||
} else if (subCommand == "TO_NATIVE_PATH") {
|
}
|
||||||
|
if (subCommand == "TO_NATIVE_PATH") {
|
||||||
return this->HandleCMakePathCommand(args, true);
|
return this->HandleCMakePathCommand(args, true);
|
||||||
} else if (subCommand == "TIMESTAMP") {
|
}
|
||||||
|
if (subCommand == "TIMESTAMP") {
|
||||||
return this->HandleTimestampCommand(args);
|
return this->HandleTimestampCommand(args);
|
||||||
} else if (subCommand == "GENERATE") {
|
}
|
||||||
|
if (subCommand == "GENERATE") {
|
||||||
return this->HandleGenerateCommand(args);
|
return this->HandleGenerateCommand(args);
|
||||||
} else if (subCommand == "LOCK") {
|
}
|
||||||
|
if (subCommand == "LOCK") {
|
||||||
return this->HandleLockCommand(args);
|
return this->HandleLockCommand(args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ public:
|
|||||||
class cmVirtualDirectoryWatcher : public cmIBaseWatcher
|
class cmVirtualDirectoryWatcher : public cmIBaseWatcher
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
~cmVirtualDirectoryWatcher()
|
~cmVirtualDirectoryWatcher() override
|
||||||
{
|
{
|
||||||
for (auto i : this->Children) {
|
for (auto i : this->Children) {
|
||||||
delete i.second;
|
delete i.second;
|
||||||
@@ -156,7 +156,7 @@ public:
|
|||||||
p->AddChildWatcher(ps, this);
|
p->AddChildWatcher(ps, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
~cmRealDirectoryWatcher()
|
~cmRealDirectoryWatcher() override
|
||||||
{
|
{
|
||||||
// Handle is freed via uv_handle_close callback!
|
// Handle is freed via uv_handle_close callback!
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -400,7 +400,7 @@ const char* cmGeneratorTarget::GetProperty(const std::string& prop) const
|
|||||||
if (!cmTargetPropertyComputer::PassesWhitelist(
|
if (!cmTargetPropertyComputer::PassesWhitelist(
|
||||||
this->GetType(), prop, this->Makefile->GetMessenger(),
|
this->GetType(), prop, this->Makefile->GetMessenger(),
|
||||||
this->GetBacktrace())) {
|
this->GetBacktrace())) {
|
||||||
return 0;
|
return CM_NULLPTR;
|
||||||
}
|
}
|
||||||
if (const char* result = cmTargetPropertyComputer::GetProperty(
|
if (const char* result = cmTargetPropertyComputer::GetProperty(
|
||||||
this, prop, this->Makefile->GetMessenger(), this->GetBacktrace())) {
|
this, prop, this->Makefile->GetMessenger(), this->GetBacktrace())) {
|
||||||
|
|||||||
@@ -247,7 +247,7 @@ bool cmGetPropertyCommand::HandleTargetMode()
|
|||||||
}
|
}
|
||||||
return this->StoreResult(CM_NULLPTR);
|
return this->StoreResult(CM_NULLPTR);
|
||||||
}
|
}
|
||||||
const char* prop_cstr = 0;
|
const char* prop_cstr = CM_NULLPTR;
|
||||||
cmListFileBacktrace bt = this->Makefile->GetBacktrace();
|
cmListFileBacktrace bt = this->Makefile->GetBacktrace();
|
||||||
cmMessenger* messenger = this->Makefile->GetMessenger();
|
cmMessenger* messenger = this->Makefile->GetMessenger();
|
||||||
if (cmTargetPropertyComputer::PassesWhitelist(
|
if (cmTargetPropertyComputer::PassesWhitelist(
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ bool cmGetTargetPropertyCommand::InitialPass(
|
|||||||
prop_exists = true;
|
prop_exists = true;
|
||||||
}
|
}
|
||||||
} else if (!args[2].empty()) {
|
} else if (!args[2].empty()) {
|
||||||
const char* prop_cstr = 0;
|
const char* prop_cstr = CM_NULLPTR;
|
||||||
cmListFileBacktrace bt = this->Makefile->GetBacktrace();
|
cmListFileBacktrace bt = this->Makefile->GetBacktrace();
|
||||||
cmMessenger* messenger = this->Makefile->GetMessenger();
|
cmMessenger* messenger = this->Makefile->GetMessenger();
|
||||||
if (cmTargetPropertyComputer::PassesWhitelist(tgt->GetType(), args[2],
|
if (cmTargetPropertyComputer::PassesWhitelist(tgt->GetType(), args[2],
|
||||||
|
|||||||
@@ -274,8 +274,9 @@ std::string cmNinjaTargetGenerator::GetPreprocessedFilePath(
|
|||||||
objName.substr(0, objName.size() - objExt.size()) + "-pp." + ppExt;
|
objName.substr(0, objName.size() - objExt.size()) + "-pp." + ppExt;
|
||||||
|
|
||||||
std::string path = this->LocalGenerator->GetHomeRelativeOutputPath();
|
std::string path = this->LocalGenerator->GetHomeRelativeOutputPath();
|
||||||
if (!path.empty())
|
if (!path.empty()) {
|
||||||
path += "/";
|
path += "/";
|
||||||
|
}
|
||||||
path += this->LocalGenerator->GetTargetDirectory(this->GeneratorTarget);
|
path += this->LocalGenerator->GetTargetDirectory(this->GeneratorTarget);
|
||||||
path += "/";
|
path += "/";
|
||||||
path += ppName;
|
path += ppName;
|
||||||
@@ -286,8 +287,9 @@ std::string cmNinjaTargetGenerator::GetDyndepFilePath(
|
|||||||
std::string const& lang) const
|
std::string const& lang) const
|
||||||
{
|
{
|
||||||
std::string path = this->LocalGenerator->GetHomeRelativeOutputPath();
|
std::string path = this->LocalGenerator->GetHomeRelativeOutputPath();
|
||||||
if (!path.empty())
|
if (!path.empty()) {
|
||||||
path += "/";
|
path += "/";
|
||||||
|
}
|
||||||
path += this->LocalGenerator->GetTargetDirectory(this->GeneratorTarget);
|
path += this->LocalGenerator->GetTargetDirectory(this->GeneratorTarget);
|
||||||
path += "/";
|
path += "/";
|
||||||
path += lang;
|
path += lang;
|
||||||
|
|||||||
@@ -42,8 +42,9 @@ static std::vector<std::string> getConfigurations(const cmake* cm)
|
|||||||
}
|
}
|
||||||
|
|
||||||
makefiles[0]->GetConfigurations(configurations);
|
makefiles[0]->GetConfigurations(configurations);
|
||||||
if (configurations.empty())
|
if (configurations.empty()) {
|
||||||
configurations.push_back("");
|
configurations.push_back("");
|
||||||
|
}
|
||||||
return configurations;
|
return configurations;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -96,20 +97,24 @@ static void getCMakeInputs(const cmGlobalGenerator* gg,
|
|||||||
if (!sourceDir.empty()) {
|
if (!sourceDir.empty()) {
|
||||||
const std::string& relative =
|
const std::string& relative =
|
||||||
cmSystemTools::RelativePath(sourceDir.c_str(), jt->c_str());
|
cmSystemTools::RelativePath(sourceDir.c_str(), jt->c_str());
|
||||||
if (toAdd.size() > relative.size())
|
if (toAdd.size() > relative.size()) {
|
||||||
toAdd = relative;
|
toAdd = relative;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isInternal) {
|
if (isInternal) {
|
||||||
if (internalFiles)
|
if (internalFiles) {
|
||||||
internalFiles->push_back(toAdd);
|
internalFiles->push_back(toAdd);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
if (isTemporary) {
|
if (isTemporary) {
|
||||||
if (tmpFiles)
|
if (tmpFiles) {
|
||||||
tmpFiles->push_back(toAdd);
|
tmpFiles->push_back(toAdd);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
if (explicitFiles)
|
if (explicitFiles) {
|
||||||
explicitFiles->push_back(toAdd);
|
explicitFiles->push_back(toAdd);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -672,8 +677,9 @@ static Json::Value DumpSourceFilesList(
|
|||||||
Json::Value result = Json::arrayValue;
|
Json::Value result = Json::arrayValue;
|
||||||
for (auto it = fileGroups.begin(); it != fileGroups.end(); ++it) {
|
for (auto it = fileGroups.begin(); it != fileGroups.end(); ++it) {
|
||||||
Json::Value group = DumpSourceFileGroup(it->first, it->second, baseDir);
|
Json::Value group = DumpSourceFileGroup(it->first, it->second, baseDir);
|
||||||
if (!group.isNull())
|
if (!group.isNull()) {
|
||||||
result.append(group);
|
result.append(group);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
@@ -821,8 +827,8 @@ static Json::Value DumpProjectList(const cmake* cm, const std::string config)
|
|||||||
Json::Value pObj = Json::objectValue;
|
Json::Value pObj = Json::objectValue;
|
||||||
pObj[kNAME_KEY] = projectIt.first;
|
pObj[kNAME_KEY] = projectIt.first;
|
||||||
|
|
||||||
assert(projectIt.second.size() >
|
// All Projects must have at least one local generator
|
||||||
0); // All Projects must have at least one local generator
|
assert(!projectIt.second.empty());
|
||||||
const cmLocalGenerator* lg = projectIt.second.at(0);
|
const cmLocalGenerator* lg = projectIt.second.at(0);
|
||||||
|
|
||||||
// Project structure information:
|
// Project structure information:
|
||||||
|
|||||||
@@ -852,13 +852,15 @@ void cmTarget::SetProperty(const std::string& prop, const char* value)
|
|||||||
e << "NAME property is read-only\n";
|
e << "NAME property is read-only\n";
|
||||||
this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str());
|
this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str());
|
||||||
return;
|
return;
|
||||||
} else if (prop == "EXPORT_NAME" && this->IsImported()) {
|
}
|
||||||
|
if (prop == "EXPORT_NAME" && this->IsImported()) {
|
||||||
std::ostringstream e;
|
std::ostringstream e;
|
||||||
e << "EXPORT_NAME property can't be set on imported targets (\""
|
e << "EXPORT_NAME property can't be set on imported targets (\""
|
||||||
<< this->Name << "\")\n";
|
<< this->Name << "\")\n";
|
||||||
this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str());
|
this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str());
|
||||||
return;
|
return;
|
||||||
} else if (prop == "SOURCES" && this->IsImported()) {
|
}
|
||||||
|
if (prop == "SOURCES" && this->IsImported()) {
|
||||||
std::ostringstream e;
|
std::ostringstream e;
|
||||||
e << "SOURCES property can't be set on imported targets (\"" << this->Name
|
e << "SOURCES property can't be set on imported targets (\"" << this->Name
|
||||||
<< "\")\n";
|
<< "\")\n";
|
||||||
@@ -932,13 +934,15 @@ void cmTarget::AppendProperty(const std::string& prop, const char* value,
|
|||||||
e << "NAME property is read-only\n";
|
e << "NAME property is read-only\n";
|
||||||
this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str());
|
this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str());
|
||||||
return;
|
return;
|
||||||
} else if (prop == "EXPORT_NAME" && this->IsImported()) {
|
}
|
||||||
|
if (prop == "EXPORT_NAME" && this->IsImported()) {
|
||||||
std::ostringstream e;
|
std::ostringstream e;
|
||||||
e << "EXPORT_NAME property can't be set on imported targets (\""
|
e << "EXPORT_NAME property can't be set on imported targets (\""
|
||||||
<< this->Name << "\")\n";
|
<< this->Name << "\")\n";
|
||||||
this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str());
|
this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str());
|
||||||
return;
|
return;
|
||||||
} else if (prop == "SOURCES" && this->IsImported()) {
|
}
|
||||||
|
if (prop == "SOURCES" && this->IsImported()) {
|
||||||
std::ostringstream e;
|
std::ostringstream e;
|
||||||
e << "SOURCES property can't be set on imported targets (\"" << this->Name
|
e << "SOURCES property can't be set on imported targets (\"" << this->Name
|
||||||
<< "\")\n";
|
<< "\")\n";
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ private:
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Support "LOCATION_<CONFIG>".
|
// Support "LOCATION_<CONFIG>".
|
||||||
else if (cmHasLiteralPrefix(prop, "LOCATION_")) {
|
if (cmHasLiteralPrefix(prop, "LOCATION_")) {
|
||||||
if (!tgt->IsImported() &&
|
if (!tgt->IsImported() &&
|
||||||
!HandleLocationPropertyPolicy(tgt->GetName(), messenger,
|
!HandleLocationPropertyPolicy(tgt->GetName(), messenger,
|
||||||
context)) {
|
context)) {
|
||||||
@@ -86,8 +86,8 @@ private:
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Support "<CONFIG>_LOCATION".
|
// Support "<CONFIG>_LOCATION".
|
||||||
else if (cmHasLiteralSuffix(prop, "_LOCATION") &&
|
if (cmHasLiteralSuffix(prop, "_LOCATION") &&
|
||||||
!cmHasLiteralPrefix(prop, "XCODE_ATTRIBUTE_")) {
|
!cmHasLiteralPrefix(prop, "XCODE_ATTRIBUTE_")) {
|
||||||
std::string configName(prop.c_str(), prop.size() - 9);
|
std::string configName(prop.c_str(), prop.size() - 9);
|
||||||
if (configName != "IMPORTED") {
|
if (configName != "IMPORTED") {
|
||||||
if (!tgt->IsImported() &&
|
if (!tgt->IsImported() &&
|
||||||
|
|||||||
@@ -414,7 +414,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
|
|||||||
return 0;
|
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 ai = args.begin() + 2;
|
||||||
std::vector<std::string>::const_iterator ae = args.end();
|
std::vector<std::string>::const_iterator ae = args.end();
|
||||||
for (; ai != ae; ++ai) {
|
for (; ai != ae; ++ai) {
|
||||||
@@ -454,7 +454,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if defined(CMAKE_BUILD_WITH_CMAKE)
|
#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> env = cmSystemTools::GetEnvironmentVariables();
|
||||||
std::vector<std::string>::iterator it;
|
std::vector<std::string>::iterator it;
|
||||||
for (it = env.begin(); it != env.end(); ++it) {
|
for (it = env.begin(); it != env.end(); ++it) {
|
||||||
@@ -464,7 +464,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
|
|||||||
}
|
}
|
||||||
#endif
|
#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.
|
// If error occurs we want to continue copying next files.
|
||||||
bool return_value = 0;
|
bool return_value = 0;
|
||||||
for (std::string::size_type cc = 2; cc < args.size(); cc++) {
|
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;
|
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]) &&
|
if (cmSystemTools::FileIsDirectory(args[2]) &&
|
||||||
!cmSystemTools::RemoveADirectory(args[2])) {
|
!cmSystemTools::RemoveADirectory(args[2])) {
|
||||||
std::cerr << "Error removing directory \"" << args[2] << "\".\n";
|
std::cerr << "Error removing directory \"" << args[2] << "\".\n";
|
||||||
@@ -486,7 +486,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Remove file
|
// Remove file
|
||||||
else if (args[1] == "remove" && args.size() > 2) {
|
if (args[1] == "remove" && args.size() > 2) {
|
||||||
bool force = false;
|
bool force = false;
|
||||||
for (std::string::size_type cc = 2; cc < args.size(); cc++) {
|
for (std::string::size_type cc = 2; cc < args.size(); cc++) {
|
||||||
if (args[cc] == "\\-f" || args[cc] == "-f") {
|
if (args[cc] == "\\-f" || args[cc] == "-f") {
|
||||||
@@ -502,8 +502,9 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
|
|||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Touch file
|
// 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++) {
|
for (std::string::size_type cc = 2; cc < args.size(); cc++) {
|
||||||
if (!cmSystemTools::Touch(args[cc], true)) {
|
if (!cmSystemTools::Touch(args[cc], true)) {
|
||||||
return 1;
|
return 1;
|
||||||
@@ -511,8 +512,9 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
|
|||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Touch file
|
// 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++) {
|
for (std::string::size_type cc = 2; cc < args.size(); cc++) {
|
||||||
// Complain if the file could not be removed, still exists,
|
// Complain if the file could not be removed, still exists,
|
||||||
// and the -f option was not given.
|
// and the -f option was not given.
|
||||||
@@ -522,8 +524,9 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
|
|||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// capabilities
|
// capabilities
|
||||||
else if (args[1] == "capabilities") {
|
if (args[1] == "capabilities") {
|
||||||
if (args.size() > 2) {
|
if (args.size() > 2) {
|
||||||
std::cerr << "-E capabilities accepts no additional arguments\n";
|
std::cerr << "-E capabilities accepts no additional arguments\n";
|
||||||
return 1;
|
return 1;
|
||||||
@@ -538,7 +541,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Sleep command
|
// Sleep command
|
||||||
else if (args[1] == "sleep" && args.size() > 2) {
|
if (args[1] == "sleep" && args.size() > 2) {
|
||||||
double total = 0;
|
double total = 0;
|
||||||
for (size_t i = 2; i < args.size(); ++i) {
|
for (size_t i = 2; i < args.size(); ++i) {
|
||||||
double num = 0.0;
|
double num = 0.0;
|
||||||
@@ -559,7 +562,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Clock command
|
// 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());
|
std::vector<std::string> command(args.begin() + 2, args.end());
|
||||||
|
|
||||||
clock_t clock_start, clock_finish;
|
clock_t clock_start, clock_finish;
|
||||||
@@ -583,8 +586,9 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
|
|||||||
<< "\n";
|
<< "\n";
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Command to calculate the md5sum of a file
|
// 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];
|
char md5out[32];
|
||||||
int retval = 0;
|
int retval = 0;
|
||||||
for (std::string::size_type cc = 2; cc < args.size(); cc++) {
|
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.
|
// 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];
|
std::string directory = args[2];
|
||||||
if (!cmSystemTools::FileExists(directory.c_str())) {
|
if (!cmSystemTools::FileExists(directory.c_str())) {
|
||||||
cmSystemTools::Error("Directory does not exist for chdir command: ",
|
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
|
// 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
|
// basically remove the directory
|
||||||
std::string dirName = args[2];
|
std::string dirName = args[2];
|
||||||
dirName += "/Progress";
|
dirName += "/Progress";
|
||||||
@@ -660,7 +664,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Command to report progress for a build
|
// 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-*
|
// This has been superseded by cmake_echo_color --progress-*
|
||||||
// options. We leave it here to avoid errors if somehow this
|
// options. We leave it here to avoid errors if somehow this
|
||||||
// is invoked by an existing makefile without regenerating.
|
// 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
|
// Command to create a symbolic link. Fails on platforms not
|
||||||
// supporting them.
|
// 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();
|
const char* destinationFileName = args[3].c_str();
|
||||||
if ((cmSystemTools::FileExists(destinationFileName) ||
|
if ((cmSystemTools::FileExists(destinationFileName) ||
|
||||||
cmSystemTools::FileIsSymlink(destinationFileName)) &&
|
cmSystemTools::FileIsSymlink(destinationFileName)) &&
|
||||||
@@ -690,16 +694,17 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Internal CMake shared library support.
|
// 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);
|
return cmcmd::SymlinkLibrary(args);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Internal CMake versioned executable support.
|
// 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);
|
return cmcmd::SymlinkExecutable(args);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Internal CMake dependency scanning support.
|
// 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();
|
const bool verbose = isCMakeVerbose();
|
||||||
|
|
||||||
// Create a cmake object instance to process dependencies.
|
// 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.
|
// 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);
|
return cmcmd::ExecuteLinkScript(args);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CMAKE_BUILD_WITH_CMAKE
|
#ifdef CMAKE_BUILD_WITH_CMAKE
|
||||||
// Internal CMake ninja dependency scanning support.
|
// 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());
|
return cmcmd_cmake_ninja_depends(args.begin() + 2, args.end());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Internal CMake ninja dyndep support.
|
// 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());
|
return cmcmd_cmake_ninja_dyndep(args.begin() + 2, args.end());
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Internal CMake unimplemented feature notification.
|
// 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.";
|
std::cerr << "Feature not implemented for this platform.";
|
||||||
if (args.size() == 3) {
|
if (args.size() == 3) {
|
||||||
std::cerr << " Variable " << args[2] << " is not set.";
|
std::cerr << " Variable " << args[2] << " is not set.";
|
||||||
}
|
}
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
return 1;
|
return 1;
|
||||||
} else if (args[1] == "vs_link_exe") {
|
}
|
||||||
|
|
||||||
|
if (args[1] == "vs_link_exe") {
|
||||||
return cmcmd::VisualStudioLink(args, 1);
|
return cmcmd::VisualStudioLink(args, 1);
|
||||||
} else if (args[1] == "vs_link_dll") {
|
}
|
||||||
|
|
||||||
|
if (args[1] == "vs_link_dll") {
|
||||||
return cmcmd::VisualStudioLink(args, 2);
|
return cmcmd::VisualStudioLink(args, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Internal CMake color makefile support.
|
// Internal CMake color makefile support.
|
||||||
else if (args[1] == "cmake_echo_color") {
|
if (args[1] == "cmake_echo_color") {
|
||||||
return cmcmd::ExecuteEchoColor(args);
|
return cmcmd::ExecuteEchoColor(args);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CMAKE_BUILD_WITH_CMAKE
|
#ifdef CMAKE_BUILD_WITH_CMAKE
|
||||||
else if (args[1] == "cmake_autogen" && args.size() >= 4) {
|
if (args[1] == "cmake_autogen" && args.size() >= 4) {
|
||||||
cmQtAutoGenerators autogen;
|
cmQtAutoGenerators autogen;
|
||||||
std::string const& config = args[3];
|
std::string const& config = args[3];
|
||||||
bool autogenSuccess = autogen.Run(args[2], config);
|
bool autogenSuccess = autogen.Run(args[2], config);
|
||||||
@@ -817,7 +828,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Tar files
|
// 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" };
|
const char* knownFormats[] = { "7zip", "gnutar", "pax", "paxr", "zip" };
|
||||||
|
|
||||||
std::string flags = args[2];
|
std::string flags = args[2];
|
||||||
@@ -921,7 +932,9 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
} else if (args[1] == "server") {
|
}
|
||||||
|
|
||||||
|
if (args[1] == "server") {
|
||||||
const std::string pipePrefix = "--pipe=";
|
const std::string pipePrefix = "--pipe=";
|
||||||
bool supportExperimental = false;
|
bool supportExperimental = false;
|
||||||
bool isDebug = false;
|
bool isDebug = false;
|
||||||
@@ -958,28 +971,26 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
|
|||||||
std::string errorMessage;
|
std::string errorMessage;
|
||||||
if (server.Serve(&errorMessage)) {
|
if (server.Serve(&errorMessage)) {
|
||||||
return 0;
|
return 0;
|
||||||
} else {
|
|
||||||
cmSystemTools::Error(errorMessage.c_str());
|
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
|
cmSystemTools::Error(errorMessage.c_str());
|
||||||
#else
|
#else
|
||||||
static_cast<void>(supportExperimental);
|
static_cast<void>(supportExperimental);
|
||||||
static_cast<void>(isDebug);
|
static_cast<void>(isDebug);
|
||||||
cmSystemTools::Error("CMake was not built with server mode enabled");
|
cmSystemTools::Error("CMake was not built with server mode enabled");
|
||||||
return 1;
|
|
||||||
#endif
|
#endif
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(CMAKE_BUILD_WITH_CMAKE)
|
#if defined(CMAKE_BUILD_WITH_CMAKE)
|
||||||
// Internal CMake Fortran module support.
|
// 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;
|
return cmDependsFortran::CopyModule(args) ? 0 : 1;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(_WIN32) && !defined(__CYGWIN__)
|
#if defined(_WIN32) && !defined(__CYGWIN__)
|
||||||
// Write registry value
|
// 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(),
|
return cmSystemTools::WriteRegistryValue(args[2].c_str(),
|
||||||
args[3].c_str())
|
args[3].c_str())
|
||||||
? 0
|
? 0
|
||||||
@@ -987,16 +998,21 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Delete registry value
|
// 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;
|
return cmSystemTools::DeleteRegistryValue(args[2].c_str()) ? 0 : 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove file
|
// 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";
|
std::cerr << "Win9x helper \"cmake -E comspec\" no longer supported\n";
|
||||||
return 1;
|
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]);
|
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]);
|
return cmcmd::WindowsCEEnvironment("9.0", args[2]);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user