summaryrefslogtreecommitdiffstats
path: root/Source/ccommand.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'Source/ccommand.cxx')
-rw-r--r--Source/ccommand.cxx50
1 files changed, 39 insertions, 11 deletions
diff --git a/Source/ccommand.cxx b/Source/ccommand.cxx
index 9f32330..640188c 100644
--- a/Source/ccommand.cxx
+++ b/Source/ccommand.cxx
@@ -22,13 +22,21 @@ void CMakeCommandUsage(const char* program)
{
std::strstream errorStream;
- errorStream << "cmake version " << cmMakefile::GetMajorVersion()
- << "." << cmMakefile::GetMinorVersion() << "\n";
- errorStream << "Usage: " << program << " [command] [arguments ...]\n"
- << "Available commands: \n"
- << " copy file destination - copy file to destination (either file or directory)\n"
- << " remove file1 file2 ... - remove the file(s)\n";
- errorStream << std::ends;
+ errorStream
+ << "cmake version " << cmMakefile::GetMajorVersion()
+ << "." << cmMakefile::GetMinorVersion() << "\n";
+
+ errorStream
+ << "Usage: " << program << " [command] [arguments ...]\n"
+ << "Available commands: \n"
+ << " copy file destination - copy file to destination (either file or directory)\n"
+ << " remove file1 file2 ... - remove the file(s)\n"
+#if defined(_WIN32) && !defined(__CYGWIN__)
+ << " write_regv key value - write registry value\n"
+ << " delete_regv key - delete registry value\n"
+#endif
+ << std::ends;
+
cmSystemTools::Error(errorStream.str());
}
@@ -40,16 +48,19 @@ int main(int ac, char** av)
args.push_back(av[i]);
}
- if ( args.size() > 1 )
+ if (args.size() > 1)
{
- if ( args[1] == "copy" && args.size() == 4 )
+ // Copy file
+ if (args[1] == "copy" && args.size() == 4)
{
cmSystemTools::cmCopyFile(args[2].c_str(), args[3].c_str());
return cmSystemTools::GetErrorOccuredFlag();
}
- if ( args[1] == "remove" && args.size() > 2 )
+
+ // Remove file
+ else if (args[1] == "remove" && 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(args[cc] != "-f")
{
@@ -62,7 +73,24 @@ int main(int ac, char** av)
}
return 0;
}
+
+#if defined(_WIN32) && !defined(__CYGWIN__)
+ // Write registry value
+ else if (args[1] == "write_regv" && args.size() > 3)
+ {
+ return cmSystemTools::WriteRegistryValue(args[2].c_str(),
+ args[3].c_str()) ? 0 : 1;
+ }
+
+ // Delete registry value
+ else if (args[1] == "delete_regv" && args.size() > 2)
+ {
+ return cmSystemTools::DeleteRegistryValue(args[2].c_str()) ? 0 : 1;
+ }
+#endif
+
}
+
::CMakeCommandUsage(args[0].c_str());
return 1;
}