From 8605551920bd0a904c146173d46fafbc2bba0b2b Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 31 Mar 2008 10:59:02 -0400 Subject: [PATCH] ENH: Improve speed of manifest tool on VS8 and VS9. - Detect filesystem type where target will be linked - Use FAT32 workaround only when fs is FAT or FAT32 --- Source/cmLocalVisualStudio7Generator.cxx | 41 +++++++++++++++++++----- 1 file changed, 33 insertions(+), 8 deletions(-) diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx index 5d30c5945..7ee40fc12 100644 --- a/Source/cmLocalVisualStudio7Generator.cxx +++ b/Source/cmLocalVisualStudio7Generator.cxx @@ -31,6 +31,8 @@ #include // for isspace +static bool cmLVS6G_IsFAT(const char* dir); + class cmLocalVisualStudio7GeneratorInternals { public: @@ -661,16 +663,21 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout, fout << "\t\t\t\tInterfaceIdentifierFileName=\"$(InputName)_i.c\"\n"; fout << "\t\t\t\tProxyFileName=\"$(InputName)_p.c\"/>\n"; // end of Version >= 8 ) { - fout << "\t\t\t\n"; + // Check the filesystem type where the target will be written. + if(cmLVS6G_IsFAT(target.GetDirectory(configName))) + { + // Add a flag telling the manifest tool to use a workaround + // for FAT32 file systems, which can cause an empty manifest + // to be embedded into the resulting executable. See CMake + // bug #2617. + fout << "\t\t\t\n"; + } } this->OutputTargetRules(fout, configName, target, libName); @@ -2054,3 +2061,21 @@ GetTargetObjectFileDirectories(cmTarget* target, dir += this->GetGlobalGenerator()->GetCMakeCFGInitDirectory(); dirs.push_back(dir); } + +//---------------------------------------------------------------------------- +#include +static bool cmLVS6G_IsFAT(const char* dir) +{ + if(dir[0] && dir[1] == ':') + { + char volRoot[4] = "_:/"; + volRoot[0] = dir[0]; + char fsName[16]; + if(GetVolumeInformation(volRoot, 0, 0, 0, 0, 0, fsName, 16) && + strstr(fsName, "FAT") != 0) + { + return true; + } + } + return false; +}