summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2019-01-10 09:34:14 -0500
committerBrad King <brad.king@kitware.com>2019-01-10 09:34:14 -0500
commit91fa6a472cd262014a74d765b003bb1cc9d7ab8a (patch)
tree67c8867e35a0ad98f2cb7260fb0744dc890f0f66
parent88c710ab56576fb80abd7940926c0fe461cf2469 (diff)
parent2ec3363ea5f5c569063a9094959cf166a54f8ce2 (diff)
downloadcmake-91fa6a472cd262014a74d765b003bb1cc9d7ab8a.tar.gz
Merge branch 'cmake-CDU-option-parsing' into release-3.13
Merge-request: !2783
-rw-r--r--Source/cmake.cxx15
-rw-r--r--Tests/RunCMake/CommandLine/C-no-file-stderr.txt2
-rw-r--r--Tests/RunCMake/CommandLine/Cno-file-result.txt1
-rw-r--r--Tests/RunCMake/CommandLine/Cno-file-stderr.txt3
-rw-r--r--Tests/RunCMake/CommandLine/D-no-src-result.txt1
-rw-r--r--Tests/RunCMake/CommandLine/D-no-src-stderr.txt2
-rw-r--r--Tests/RunCMake/CommandLine/Dno-src-result.txt1
-rw-r--r--Tests/RunCMake/CommandLine/Dno-src-stderr.txt2
-rw-r--r--Tests/RunCMake/CommandLine/RunCMakeTest.cmake5
-rw-r--r--Tests/RunCMake/CommandLine/U-no-src-result.txt1
-rw-r--r--Tests/RunCMake/CommandLine/U-no-src-stderr.txt2
-rw-r--r--Tests/RunCMake/CommandLine/Uno-src-result.txt1
-rw-r--r--Tests/RunCMake/CommandLine/Uno-src-stderr.txt2
13 files changed, 37 insertions, 1 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++;
diff --git a/Tests/RunCMake/CommandLine/C-no-file-stderr.txt b/Tests/RunCMake/CommandLine/C-no-file-stderr.txt
index 5315f59047..2a4ee6451e 100644
--- a/Tests/RunCMake/CommandLine/C-no-file-stderr.txt
+++ b/Tests/RunCMake/CommandLine/C-no-file-stderr.txt
@@ -1,3 +1,3 @@
^CMake Error: Error processing file: nosuchcachefile.txt
-CMake Error: The source directory ".*/Tests/RunCMake/CommandLine/C-no-file-build/nosuchcachefile.txt" does not exist.
+CMake Error: The source directory ".*/Tests/RunCMake/CommandLine/C-no-file-build" does not appear to contain CMakeLists.txt.
Specify --help for usage, or press the help button on the CMake GUI.$
diff --git a/Tests/RunCMake/CommandLine/Cno-file-result.txt b/Tests/RunCMake/CommandLine/Cno-file-result.txt
new file mode 100644
index 0000000000..d00491fd7e
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/Cno-file-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CommandLine/Cno-file-stderr.txt b/Tests/RunCMake/CommandLine/Cno-file-stderr.txt
new file mode 100644
index 0000000000..67a20324c8
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/Cno-file-stderr.txt
@@ -0,0 +1,3 @@
+^CMake Error: Error processing file: nosuchcachefile.txt
+CMake Error: The source directory ".*/Tests/RunCMake/CommandLine/Cno-file-build" does not appear to contain CMakeLists.txt.
+Specify --help for usage, or press the help button on the CMake GUI.$
diff --git a/Tests/RunCMake/CommandLine/D-no-src-result.txt b/Tests/RunCMake/CommandLine/D-no-src-result.txt
new file mode 100644
index 0000000000..d00491fd7e
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/D-no-src-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CommandLine/D-no-src-stderr.txt b/Tests/RunCMake/CommandLine/D-no-src-stderr.txt
new file mode 100644
index 0000000000..b5ac69c3ed
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/D-no-src-stderr.txt
@@ -0,0 +1,2 @@
+^CMake Error: The source directory ".*/Tests/RunCMake/CommandLine/D-no-src-build" does not appear to contain CMakeLists.txt.
+Specify --help for usage, or press the help button on the CMake GUI.$
diff --git a/Tests/RunCMake/CommandLine/Dno-src-result.txt b/Tests/RunCMake/CommandLine/Dno-src-result.txt
new file mode 100644
index 0000000000..d00491fd7e
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/Dno-src-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CommandLine/Dno-src-stderr.txt b/Tests/RunCMake/CommandLine/Dno-src-stderr.txt
new file mode 100644
index 0000000000..402c714093
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/Dno-src-stderr.txt
@@ -0,0 +1,2 @@
+^CMake Error: The source directory ".*/Tests/RunCMake/CommandLine/Dno-src-build" does not appear to contain CMakeLists.txt.
+Specify --help for usage, or press the help button on the CMake GUI.$
diff --git a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake
index 9859df1426..b47abfb2c2 100644
--- a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake
@@ -6,10 +6,15 @@ run_cmake_command(NoArgs ${CMAKE_COMMAND})
run_cmake_command(Wizard ${CMAKE_COMMAND} -i)
run_cmake_command(C-no-arg ${CMAKE_COMMAND} -C)
run_cmake_command(C-no-file ${CMAKE_COMMAND} -C nosuchcachefile.txt)
+run_cmake_command(Cno-file ${CMAKE_COMMAND} -Cnosuchcachefile.txt)
run_cmake_command(cache-no-file ${CMAKE_COMMAND} nosuchsubdir/CMakeCache.txt)
run_cmake_command(lists-no-file ${CMAKE_COMMAND} nosuchsubdir/CMakeLists.txt)
run_cmake_command(D-no-arg ${CMAKE_COMMAND} -D)
+run_cmake_command(D-no-src ${CMAKE_COMMAND} -D VAR=VALUE)
+run_cmake_command(Dno-src ${CMAKE_COMMAND} -DVAR=VALUE)
run_cmake_command(U-no-arg ${CMAKE_COMMAND} -U)
+run_cmake_command(U-no-src ${CMAKE_COMMAND} -U VAR)
+run_cmake_command(Uno-src ${CMAKE_COMMAND} -UVAR)
run_cmake_command(E-no-arg ${CMAKE_COMMAND} -E)
run_cmake_command(E_capabilities ${CMAKE_COMMAND} -E capabilities)
run_cmake_command(E_capabilities-arg ${CMAKE_COMMAND} -E capabilities --extra-arg)
diff --git a/Tests/RunCMake/CommandLine/U-no-src-result.txt b/Tests/RunCMake/CommandLine/U-no-src-result.txt
new file mode 100644
index 0000000000..d00491fd7e
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/U-no-src-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CommandLine/U-no-src-stderr.txt b/Tests/RunCMake/CommandLine/U-no-src-stderr.txt
new file mode 100644
index 0000000000..a3b4b12cc9
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/U-no-src-stderr.txt
@@ -0,0 +1,2 @@
+^CMake Error: The source directory ".*/Tests/RunCMake/CommandLine/U-no-src-build" does not appear to contain CMakeLists.txt.
+Specify --help for usage, or press the help button on the CMake GUI.$
diff --git a/Tests/RunCMake/CommandLine/Uno-src-result.txt b/Tests/RunCMake/CommandLine/Uno-src-result.txt
new file mode 100644
index 0000000000..d00491fd7e
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/Uno-src-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CommandLine/Uno-src-stderr.txt b/Tests/RunCMake/CommandLine/Uno-src-stderr.txt
new file mode 100644
index 0000000000..baa8d63efa
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/Uno-src-stderr.txt
@@ -0,0 +1,2 @@
+^CMake Error: The source directory ".*/Tests/RunCMake/CommandLine/Uno-src-build" does not appear to contain CMakeLists.txt.
+Specify --help for usage, or press the help button on the CMake GUI.$