summaryrefslogtreecommitdiffstats
path: root/Source/cmake.cxx
diff options
context:
space:
mode:
authorPaul Seyfert <pseyfert.mathphys@gmail.com>2018-10-23 19:04:34 (GMT)
committerBrad King <brad.king@kitware.com>2018-10-26 13:50:00 (GMT)
commit5873815fef1df2dadfeaa8a13190d0365f77838a (patch)
tree2d736e697bab6620f51727f3fa46eceaab87fad8 /Source/cmake.cxx
parent8ec4b5a93028153c8ec443bee7038843cb8a3866 (diff)
downloadCMake-5873815fef1df2dadfeaa8a13190d0365f77838a.zip
CMake-5873815fef1df2dadfeaa8a13190d0365f77838a.tar.gz
CMake-5873815fef1df2dadfeaa8a13190d0365f77838a.tar.bz2
cmake: distinguish '-Cpath' from '-C path' in source dir parsing
This results in the correct source directory being picked up in calls with cmake sourcedir -C settings and in a more appropriate error message when calling mkdir build ; cd build ; cmake -C settings Also fix `-D` and `-U` in the same way.
Diffstat (limited to 'Source/cmake.cxx')
-rw-r--r--Source/cmake.cxx15
1 files changed, 15 insertions, 0 deletions
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index 889a5fb..1aff5eb 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -676,10 +676,25 @@ void cmake::SetArgs(const std::vector<std::string>& args,
#endif
else if (arg.find("-D", 0) == 0) {
// skip for now
+ // in case '-D var=val' is given, also skip the next
+ // in case '-Dvar=val' is given, don't skip the next
+ if (arg.size() == 2) {
+ ++i;
+ }
} else if (arg.find("-U", 0) == 0) {
// skip for now
+ // in case '-U var' is given, also skip the next
+ // in case '-Uvar' is given, don't skip the next
+ if (arg.size() == 2) {
+ ++i;
+ }
} else if (arg.find("-C", 0) == 0) {
// skip for now
+ // in case '-C path' is given, also skip the next
+ // in case '-Cpath' is given, don't skip the next
+ if (arg.size() == 2) {
+ ++i;
+ }
} else if (arg.find("-P", 0) == 0) {
// skip for now
i++;