summaryrefslogtreecommitdiffstats
path: root/Source/cmIncludeCommand.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2012-07-10 14:55:02 (GMT)
committerBrad King <brad.king@kitware.com>2012-07-10 15:05:04 (GMT)
commit2e99949ccb216c59ff1932bc3773654e9ae54419 (patch)
treee0a7ee0de24eab9b10f1fcfceead009d0faf2f3b /Source/cmIncludeCommand.cxx
parent6274ca6f910683495124d22e371a1adc9cf0eebc (diff)
downloadCMake-2e99949ccb216c59ff1932bc3773654e9ae54419.zip
CMake-2e99949ccb216c59ff1932bc3773654e9ae54419.tar.gz
CMake-2e99949ccb216c59ff1932bc3773654e9ae54419.tar.bz2
include: Ignore empty string as file name (#13388)
Previously CMake silently accepted the empty string and added a bogus dependency on the current directory. Instead warn about the empty file name and ignore it. We cannot make this an error because there may be existing projects that accidentally depend on the old behavior. Add a RunCMake.include test to cover this case.
Diffstat (limited to 'Source/cmIncludeCommand.cxx')
-rw-r--r--Source/cmIncludeCommand.cxx7
1 files changed, 7 insertions, 0 deletions
diff --git a/Source/cmIncludeCommand.cxx b/Source/cmIncludeCommand.cxx
index 0ac6df4..0d5f67b 100644
--- a/Source/cmIncludeCommand.cxx
+++ b/Source/cmIncludeCommand.cxx
@@ -70,6 +70,13 @@ bool cmIncludeCommand
}
}
+ if(fname.empty())
+ {
+ this->Makefile->IssueMessage(cmake::AUTHOR_WARNING,
+ "include() given empty file name (ignored).");
+ return true;
+ }
+
if(!cmSystemTools::FileIsFullPath(fname.c_str()))
{
// Not a path. Maybe module.