From 5873815fef1df2dadfeaa8a13190d0365f77838a Mon Sep 17 00:00:00 2001 From: Paul Seyfert Date: Tue, 23 Oct 2018 21:04:34 +0200 Subject: 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. --- Source/cmake.cxx | 15 +++++++++++++++ 1 file changed, 15 insertions(+) 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& 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++; -- cgit v0.12