summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorClinton Stimpson <clinton@elemtech.com>2013-12-18 21:38:56 (GMT)
committerClinton Stimpson <clinton@elemtech.com>2014-01-04 17:43:12 (GMT)
commita1e542f19551072f101404e16e1dad901189f039 (patch)
tree215a0e8627dfabc2e113c5881b52c29aa013abbd /Source
parent7fb2b806626b9af791d7372d2ff82b2cf1503237 (diff)
downloadCMake-a1e542f19551072f101404e16e1dad901189f039.zip
CMake-a1e542f19551072f101404e16e1dad901189f039.tar.gz
CMake-a1e542f19551072f101404e16e1dad901189f039.tar.bz2
Use Encoding::CommandLineArguments for main() functions.
Diffstat (limited to 'Source')
-rw-r--r--Source/CPack/cpack.cxx8
-rw-r--r--Source/CursesDialog/ccmake.cxx8
-rw-r--r--Source/QtDialog/CMakeSetup.cxx16
-rw-r--r--Source/cmakemain.cxx18
-rw-r--r--Source/ctest.cxx8
5 files changed, 44 insertions, 14 deletions
diff --git a/Source/CPack/cpack.cxx b/Source/CPack/cpack.cxx
index 438b16d..a19b778 100644
--- a/Source/CPack/cpack.cxx
+++ b/Source/CPack/cpack.cxx
@@ -25,6 +25,7 @@
#include <cmsys/CommandLineArguments.hxx>
#include <cmsys/SystemTools.hxx>
+#include <cmsys/Encoding.hxx>
//----------------------------------------------------------------------------
static const char * cmDocumentationName[][2] =
@@ -97,8 +98,13 @@ int cpackDefinitionArgument(const char* argument, const char* cValue,
//----------------------------------------------------------------------------
// this is CPack.
-int main (int argc, char *argv[])
+int main (int argc, char const* const* argv)
{
+ cmsys::Encoding::CommandLineArguments args =
+ cmsys::Encoding::CommandLineArguments::Main(argc, argv);
+ argc = args.argc();
+ argv = args.argv();
+
cmSystemTools::FindCMakeResources(argv[0]);
cmCPackLog log;
diff --git a/Source/CursesDialog/ccmake.cxx b/Source/CursesDialog/ccmake.cxx
index ce50845..2d1ef5c 100644
--- a/Source/CursesDialog/ccmake.cxx
+++ b/Source/CursesDialog/ccmake.cxx
@@ -19,6 +19,7 @@
#include "cmCursesMainForm.h"
#include "cmCursesStandardIncludes.h"
+#include <cmsys/Encoding.hxx>
#include <form.h>
@@ -78,8 +79,13 @@ void CMakeErrorHandler(const char* message, const char* title, bool&, void* clie
self->AddError(message, title);
}
-int main(int argc, char** argv)
+int main(int argc, char const* const* argv)
{
+ cmsys::Encoding::CommandLineArguments encoding_args =
+ cmsys::Encoding::CommandLineArguments::Main(argc, argv);
+ argc = encoding_args.argc();
+ argv = encoding_args.argv();
+
cmSystemTools::FindCMakeResources(argv[0]);
cmDocumentation doc;
doc.addCMakeStandardDocSections();
diff --git a/Source/QtDialog/CMakeSetup.cxx b/Source/QtDialog/CMakeSetup.cxx
index 408bb4c..821121e 100644
--- a/Source/QtDialog/CMakeSetup.cxx
+++ b/Source/QtDialog/CMakeSetup.cxx
@@ -21,6 +21,7 @@
#include "cmVersion.h"
#include <cmsys/CommandLineArguments.hxx>
#include <cmsys/SystemTools.hxx>
+#include <cmsys/Encoding.hxx>
//----------------------------------------------------------------------------
static const char * cmDocumentationName[][2] =
@@ -48,12 +49,17 @@ static const char * cmDocumentationOptions[][2] =
int main(int argc, char** argv)
{
- cmSystemTools::FindCMakeResources(argv[0]);
+ cmsys::Encoding::CommandLineArguments encoding_args =
+ cmsys::Encoding::CommandLineArguments::Main(argc, argv);
+ int argc2 = encoding_args.argc();
+ char const* const* argv2 = encoding_args.argv();
+
+ cmSystemTools::FindCMakeResources(argv2[0]);
// check docs first so that X is not need to get docs
// do docs, if args were given
cmDocumentation doc;
doc.addCMakeStandardDocSections();
- if(argc >1 && doc.CheckOptions(argc, argv))
+ if(argc2 >1 && doc.CheckOptions(argc2, argv2))
{
// Construct and print requested documentation.
cmake hcm;
@@ -80,9 +86,9 @@ int main(int argc, char** argv)
}
// if arg for install
- for(int i =0; i < argc; i++)
+ for(int i =0; i < argc2; i++)
{
- if(strcmp(argv[i], "--mac-install") == 0)
+ if(strcmp(argv2[i], "--mac-install") == 0)
{
QMacInstallDialog setupdialog(0);
setupdialog.exec();
@@ -116,7 +122,7 @@ int main(int argc, char** argv)
dialog.show();
cmsys::CommandLineArguments arg;
- arg.Initialize(argc, argv);
+ arg.Initialize(argc2, argv2);
std::string binaryDirectory;
std::string sourceDirectory;
typedef cmsys::CommandLineArguments argT;
diff --git a/Source/cmakemain.cxx b/Source/cmakemain.cxx
index 882b072..fcaa127 100644
--- a/Source/cmakemain.cxx
+++ b/Source/cmakemain.cxx
@@ -24,6 +24,7 @@
#include "cmGlobalGenerator.h"
#include "cmLocalGenerator.h"
#include "cmMakefile.h"
+#include <cmsys/Encoding.hxx>
#ifdef CMAKE_BUILD_WITH_CMAKE
//----------------------------------------------------------------------------
@@ -79,7 +80,7 @@ static const char * cmDocumentationOptions[][2] =
#endif
-static int do_command(int ac, char** av)
+static int do_command(int ac, char const* const* av)
{
std::vector<std::string> args;
args.push_back(av[0]);
@@ -90,8 +91,8 @@ static int do_command(int ac, char** av)
return cmcmd::ExecuteCMakeCommand(args);
}
-int do_cmake(int ac, char** av);
-static int do_build(int ac, char** av);
+int do_cmake(int ac, char const* const* av);
+static int do_build(int ac, char const* const* av);
static cmMakefile* cmakemainGetMakefile(void *clientdata)
{
@@ -159,8 +160,13 @@ static void cmakemainProgressCallback(const char *m, float prog,
}
-int main(int ac, char** av)
+int main(int ac, char const* const* av)
{
+ cmsys::Encoding::CommandLineArguments args =
+ cmsys::Encoding::CommandLineArguments::Main(ac, av);
+ ac = args.argc();
+ av = args.argv();
+
cmSystemTools::EnableMSVCDebugHook();
cmSystemTools::FindCMakeResources(av[0]);
if(ac > 1)
@@ -181,7 +187,7 @@ int main(int ac, char** av)
return ret;
}
-int do_cmake(int ac, char** av)
+int do_cmake(int ac, char const* const* av)
{
if ( cmSystemTools::GetCurrentWorkingDirectory().size() == 0 )
{
@@ -352,7 +358,7 @@ int do_cmake(int ac, char** av)
}
//----------------------------------------------------------------------------
-static int do_build(int ac, char** av)
+static int do_build(int ac, char const* const* av)
{
#ifndef CMAKE_BUILD_WITH_CMAKE
std::cerr << "This cmake does not support --build\n";
diff --git a/Source/ctest.cxx b/Source/ctest.cxx
index de07458..3eb5551 100644
--- a/Source/ctest.cxx
+++ b/Source/ctest.cxx
@@ -18,6 +18,7 @@
#include "CTest/cmCTestScriptHandler.h"
#include "CTest/cmCTestLaunch.h"
+#include "cmsys/Encoding.hxx"
//----------------------------------------------------------------------------
static const char * cmDocumentationName[][2] =
@@ -111,8 +112,13 @@ static const char * cmDocumentationOptions[][2] =
};
// this is a test driver program for cmCTest.
-int main (int argc, char *argv[])
+int main (int argc, char const* const* argv)
{
+ cmsys::Encoding::CommandLineArguments encoding_args =
+ cmsys::Encoding::CommandLineArguments::Main(argc, argv);
+ argc = encoding_args.argc();
+ argv = encoding_args.argv();
+
cmSystemTools::DoNotInheritStdPipes();
cmSystemTools::EnableMSVCDebugHook();
cmSystemTools::FindCMakeResources(argv[0]);