summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2018-06-22 09:31:45 -0400
committerBrad King <brad.king@kitware.com>2018-06-22 09:39:05 -0400
commit142a6257294afbfdf86ec13fdb4ecf303b131f99 (patch)
tree440c9c968424de18f4f255b021208241c2864eb0
parentef5e2e8a62982ebccf4883fc7a01cdb66f8ca183 (diff)
downloadcmake-142a6257294afbfdf86ec13fdb4ecf303b131f99.tar.gz
file: Drop error cases added by CMake 3.12.0-rc1 to avoid regressions
Refactoring in commit v3.12.0-rc1~418^2~3 (Refactor HandleGlobCommand, 2018-02-13) introduced error diagnostics for argument combinations that were previously accepted. Restore acceptance to avoid regressing projects that used those combinations even if they do not make sense. Fixes: #18097
-rw-r--r--Source/cmFileCommand.cxx28
-rw-r--r--Tests/RunCMake/file/GLOB-error-FOLLOW_SYMLINKS-result.txt1
-rw-r--r--Tests/RunCMake/file/GLOB-error-FOLLOW_SYMLINKS-stderr.txt4
-rw-r--r--Tests/RunCMake/file/GLOB-noexp-FOLLOW_SYMLINKS.cmake (renamed from Tests/RunCMake/file/GLOB-error-FOLLOW_SYMLINKS.cmake)0
-rw-r--r--Tests/RunCMake/file/GLOB-noexp-LIST_DIRECTORIES-result.txt1
-rw-r--r--Tests/RunCMake/file/GLOB-noexp-LIST_DIRECTORIES-stderr.txt4
-rw-r--r--Tests/RunCMake/file/RunCMakeTest.cmake2
7 files changed, 12 insertions, 28 deletions
diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx
index aae70b160c..dcb79f7dd2 100644
--- a/Source/cmFileCommand.cxx
+++ b/Source/cmFileCommand.cxx
@@ -777,7 +777,7 @@ bool cmFileCommand::HandleGlobCommand(std::vector<std::string> const& args,
this->Makefile->GetCMakeInstance()->GetWorkingMode();
while (i != args.end()) {
if (*i == "LIST_DIRECTORIES") {
- ++i;
+ ++i; // skip LIST_DIRECTORIES
if (i != args.end()) {
if (cmSystemTools::IsOn(i->c_str())) {
g.SetListDirs(true);
@@ -789,27 +789,21 @@ bool cmFileCommand::HandleGlobCommand(std::vector<std::string> const& args,
this->SetError("LIST_DIRECTORIES missing bool value.");
return false;
}
+ ++i;
} else {
this->SetError("LIST_DIRECTORIES missing bool value.");
return false;
}
- ++i;
- if (i == args.end()) {
- this->SetError("GLOB requires a glob expression after the bool.");
- return false;
- }
} else if (*i == "FOLLOW_SYMLINKS") {
- if (!recurse) {
- this->SetError("FOLLOW_SYMLINKS is not a valid parameter for GLOB.");
- return false;
- }
- explicitFollowSymlinks = true;
- g.RecurseThroughSymlinksOn();
- ++i;
- if (i == args.end()) {
- this->SetError(
- "GLOB_RECURSE requires a glob expression after FOLLOW_SYMLINKS.");
- return false;
+ ++i; // skip FOLLOW_SYMLINKS
+ if (recurse) {
+ explicitFollowSymlinks = true;
+ g.RecurseThroughSymlinksOn();
+ if (i == args.end()) {
+ this->SetError(
+ "GLOB_RECURSE requires a glob expression after FOLLOW_SYMLINKS.");
+ return false;
+ }
}
} else if (*i == "RELATIVE") {
++i; // skip RELATIVE
diff --git a/Tests/RunCMake/file/GLOB-error-FOLLOW_SYMLINKS-result.txt b/Tests/RunCMake/file/GLOB-error-FOLLOW_SYMLINKS-result.txt
deleted file mode 100644
index d00491fd7e..0000000000
--- a/Tests/RunCMake/file/GLOB-error-FOLLOW_SYMLINKS-result.txt
+++ /dev/null
@@ -1 +0,0 @@
-1
diff --git a/Tests/RunCMake/file/GLOB-error-FOLLOW_SYMLINKS-stderr.txt b/Tests/RunCMake/file/GLOB-error-FOLLOW_SYMLINKS-stderr.txt
deleted file mode 100644
index af3cb2e5a3..0000000000
--- a/Tests/RunCMake/file/GLOB-error-FOLLOW_SYMLINKS-stderr.txt
+++ /dev/null
@@ -1,4 +0,0 @@
-^CMake Error at GLOB-error-FOLLOW_SYMLINKS\.cmake:[0-9]+ \(file\):
- file FOLLOW_SYMLINKS is not a valid parameter for GLOB\.
-Call Stack \(most recent call first\):
- CMakeLists\.txt:[0-9]+ \(include\)$
diff --git a/Tests/RunCMake/file/GLOB-error-FOLLOW_SYMLINKS.cmake b/Tests/RunCMake/file/GLOB-noexp-FOLLOW_SYMLINKS.cmake
index 6d467a0c67..6d467a0c67 100644
--- a/Tests/RunCMake/file/GLOB-error-FOLLOW_SYMLINKS.cmake
+++ b/Tests/RunCMake/file/GLOB-noexp-FOLLOW_SYMLINKS.cmake
diff --git a/Tests/RunCMake/file/GLOB-noexp-LIST_DIRECTORIES-result.txt b/Tests/RunCMake/file/GLOB-noexp-LIST_DIRECTORIES-result.txt
deleted file mode 100644
index d00491fd7e..0000000000
--- a/Tests/RunCMake/file/GLOB-noexp-LIST_DIRECTORIES-result.txt
+++ /dev/null
@@ -1 +0,0 @@
-1
diff --git a/Tests/RunCMake/file/GLOB-noexp-LIST_DIRECTORIES-stderr.txt b/Tests/RunCMake/file/GLOB-noexp-LIST_DIRECTORIES-stderr.txt
deleted file mode 100644
index ee6cb0b58b..0000000000
--- a/Tests/RunCMake/file/GLOB-noexp-LIST_DIRECTORIES-stderr.txt
+++ /dev/null
@@ -1,4 +0,0 @@
-^CMake Error at GLOB-noexp-LIST_DIRECTORIES\.cmake:[0-9]+ \(file\):
- file GLOB requires a glob expression after the bool\.
-Call Stack \(most recent call first\):
- CMakeLists\.txt:[0-9]+ \(include\)$
diff --git a/Tests/RunCMake/file/RunCMakeTest.cmake b/Tests/RunCMake/file/RunCMakeTest.cmake
index 342606b445..b3832301a8 100644
--- a/Tests/RunCMake/file/RunCMakeTest.cmake
+++ b/Tests/RunCMake/file/RunCMakeTest.cmake
@@ -39,12 +39,12 @@ run_cmake(GLOB_RECURSE-noexp-FOLLOW_SYMLINKS)
# tests are valid both for GLOB and GLOB_RECURSE
run_cmake(GLOB-sort-dedup)
-run_cmake(GLOB-error-FOLLOW_SYMLINKS)
run_cmake(GLOB-error-LIST_DIRECTORIES-not-boolean)
run_cmake(GLOB-error-LIST_DIRECTORIES-no-arg)
run_cmake(GLOB-error-RELATIVE-no-arg)
run_cmake(GLOB-error-CONFIGURE_DEPENDS-modified)
run_cmake(GLOB-noexp-CONFIGURE_DEPENDS)
+run_cmake(GLOB-noexp-FOLLOW_SYMLINKS)
run_cmake(GLOB-noexp-LIST_DIRECTORIES)
run_cmake(GLOB-noexp-RELATIVE)
run_cmake_command(GLOB-error-CONFIGURE_DEPENDS-SCRIPT_MODE ${CMAKE_COMMAND} -P