summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2015-04-06 12:58:17 (GMT)
committerCMake Topic Stage <kwrobot@kitware.com>2015-04-06 12:58:17 (GMT)
commitb9c1eb4dcc801ea0a8f3f33aec58c5f9ab04026e (patch)
tree5586d3fceb7d2fdfb0e277a63c71e2705940edee /Source
parent9ddbacdb74c7f3daf824decee9a1d900ddb44744 (diff)
parentaf924827120f39f1a7a940bc3f6bc487665145d9 (diff)
downloadCMake-b9c1eb4dcc801ea0a8f3f33aec58c5f9ab04026e.zip
CMake-b9c1eb4dcc801ea0a8f3f33aec58c5f9ab04026e.tar.gz
CMake-b9c1eb4dcc801ea0a8f3f33aec58c5f9ab04026e.tar.bz2
Merge topic 'makefile-depscan-BOM'
af924827 Makefile: Tolerate a BOM while scanning source dependencies (#15493)
Diffstat (limited to 'Source')
-rw-r--r--Source/cmDependsC.cxx21
1 files changed, 15 insertions, 6 deletions
diff --git a/Source/cmDependsC.cxx b/Source/cmDependsC.cxx
index 63d8fa6..6cdd4c1 100644
--- a/Source/cmDependsC.cxx
+++ b/Source/cmDependsC.cxx
@@ -242,13 +242,22 @@ bool cmDependsC::WriteDependencies(const std::set<std::string>& sources,
cmsys::ifstream fin(fullName.c_str());
if(fin)
{
- // Add this file as a dependency.
- dependencies.insert(fullName);
+ cmsys::FStream::BOM bom = cmsys::FStream::ReadBOM(fin);
+ if(bom == cmsys::FStream::BOM_None ||
+ bom == cmsys::FStream::BOM_UTF8)
+ {
+ // Add this file as a dependency.
+ dependencies.insert(fullName);
- // Scan this file for new dependencies. Pass the directory
- // containing the file to handle double-quote includes.
- std::string dir = cmSystemTools::GetFilenamePath(fullName);
- this->Scan(fin, dir.c_str(), fullName);
+ // Scan this file for new dependencies. Pass the directory
+ // containing the file to handle double-quote includes.
+ std::string dir = cmSystemTools::GetFilenamePath(fullName);
+ this->Scan(fin, dir.c_str(), fullName);
+ }
+ else
+ {
+ // Skip file with encoding we do not implement.
+ }
}
}
}