diff options
author | Brad King <brad.king@kitware.com> | 2015-04-06 12:58:17 (GMT) |
---|---|---|
committer | CMake Topic Stage <kwrobot@kitware.com> | 2015-04-06 12:58:17 (GMT) |
commit | b9c1eb4dcc801ea0a8f3f33aec58c5f9ab04026e (patch) | |
tree | 5586d3fceb7d2fdfb0e277a63c71e2705940edee /Source | |
parent | 9ddbacdb74c7f3daf824decee9a1d900ddb44744 (diff) | |
parent | af924827120f39f1a7a940bc3f6bc487665145d9 (diff) | |
download | CMake-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.cxx | 21 |
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. + } } } } |