mirror of
https://github.com/Kitware/CMake.git
synced 2026-05-20 06:48:38 -05:00
file: Fix crash on GLOB with no expressions after LIST_DIRECTORIES
Since commit v3.3.0-rc1~318^2~1 (file: Teach GLOB to list directories optionally, 2015-03-17) using `LIST_DIRECTORIES` followed by no expression causes a crash. Fix the logic to avoid the crash. Fixes: #16565
This commit is contained in:
@@ -788,7 +788,7 @@ bool cmFileCommand::HandleGlobCommand(std::vector<std::string> const& args,
|
|||||||
this->SetError("LIST_DIRECTORIES missing bool value.");
|
this->SetError("LIST_DIRECTORIES missing bool value.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
++i;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (recurse && (*i == "FOLLOW_SYMLINKS")) {
|
if (recurse && (*i == "FOLLOW_SYMLINKS")) {
|
||||||
|
|||||||
@@ -0,0 +1 @@
|
|||||||
|
file(GLOB CONTENT_LIST LIST_DIRECTORIES false)
|
||||||
@@ -31,6 +31,7 @@ run_cmake(GLOB_RECURSE)
|
|||||||
run_cmake(GLOB-error-LIST_DIRECTORIES-not-boolean)
|
run_cmake(GLOB-error-LIST_DIRECTORIES-not-boolean)
|
||||||
# test is valid both for GLOB and GLOB_RECURSE
|
# test is valid both for GLOB and GLOB_RECURSE
|
||||||
run_cmake(GLOB-error-LIST_DIRECTORIES-no-arg)
|
run_cmake(GLOB-error-LIST_DIRECTORIES-no-arg)
|
||||||
|
run_cmake(GLOB-noexp-LIST_DIRECTORIES)
|
||||||
|
|
||||||
if(NOT WIN32 OR CYGWIN)
|
if(NOT WIN32 OR CYGWIN)
|
||||||
run_cmake(GLOB_RECURSE-cyclic-recursion)
|
run_cmake(GLOB_RECURSE-cyclic-recursion)
|
||||||
|
|||||||
Reference in New Issue
Block a user