summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
Diffstat (limited to 'Source')
-rw-r--r--Source/cmake.cxx3
-rw-r--r--Source/cmakemain.cxx6
2 files changed, 8 insertions, 1 deletions
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index c1c2698..9c4f7d9 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -217,7 +217,8 @@ bool cmake::SetCacheArgs(const std::vector<std::string>& args)
}
else if(arg.find("-P",0) == 0)
{
- std::string path = arg.substr(strlen("-P"));
+ i++;
+ std::string path = args[i];
if ( path.size() == 0 )
{
cmSystemTools::Error("No cmake scrpt provided.");
diff --git a/Source/cmakemain.cxx b/Source/cmakemain.cxx
index 7c9a155..3b29bf5 100644
--- a/Source/cmakemain.cxx
+++ b/Source/cmakemain.cxx
@@ -185,8 +185,14 @@ int do_cmake(int ac, char** av)
}
else if (strncmp(av[i], "-P", strlen("-P")) == 0)
{
+ if ( i == ac -1 )
+ {
+ cmSystemTools::Error("No script specified for argument -P");
+ }
script_mode = true;
args.push_back(av[i]);
+ i++;
+ args.push_back(av[i]);
}
else
{