Jelajahi Sumber

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.
Paul Seyfert 7 tahun lalu
induk
melakukan
6d53a60f00
1 mengubah file dengan 15 tambahan dan 0 penghapusan
  1. 15 0
      Source/cmake.cxx

+ 15 - 0
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++;