Glob: issue warnings on Directory errors
This will make cmake produce error when recursive globbing fails. For example:
project(foo)
file(GLOB_RECURSE foo /foo/*)
produces
CMake Error at CMakeLists.txt:2 (file):
Error has occurred while globbing for '/foo/*' - Error listing directory
'/foo/'! Reason: 'No such file or directory'
To make this into a warning, another change will need to be applied to cmake:
diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx
index f3d49c36a6..428e842f0f 100644
--- a/Source/cmFileCommand.cxx
+++ b/Source/cmFileCommand.cxx
@@ -770,12 +770,17 @@ bool HandleGlobImpl(std::vector<std::string> const& args, bool recurse,
MessageType::AUTHOR_WARNING,
"Cyclic recursion detected while globbing for '" + *i + "':\n" +
globMessage.content);
- } else {
+ } else if (globMessage.type == cmsys::Glob::error) {
status.GetMakefile().IssueMessage(
MessageType::FATAL_ERROR,
"Error has occurred while globbing for '" + *i + "' - " +
globMessage.content);
shouldExit = true;
+ } else {
+ status.GetMakefile().IssueMessage(
+ MessageType::LOG,
+ "Error while globbing for '" + *i + "':\n" +
+ globMessage.content);
}
}
if (shouldExit) {
Topic-rename: Directory-error-handling
Edited by Brad King