summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Seyfert <pseyfert.mathphys@gmail.com>2018-10-23 21:04:34 +0200
committerCraig Scott <craig.scott@crascit.com>2019-01-10 21:19:24 +1100
commit6d53a60f007b0a1a1c03ce5f9373eddc55f49d5a (patch)
treed20773cc3ffccb033315c5f93111639f19f8a72d
parent9bbfbd54ba04e07b0bf2eb8bb1056bca53d639c5 (diff)
downloadcmake-6d53a60f007b0a1a1c03ce5f9373eddc55f49d5a.tar.gz
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.
-rw-r--r--Source/cmake.cxx15
1 files changed, 15 insertions, 0 deletions
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index 889a5fbdf7..1aff5eb372 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++;