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
This commit is contained in:
Brad King 2008-03-31 10:59:02 -04:00
parent 5b3e62c7bc
commit 8605551920
1 changed files with 33 additions and 8 deletions

View File

@ -31,6 +31,8 @@
#include <ctype.h> // for isspace #include <ctype.h> // for isspace
static bool cmLVS6G_IsFAT(const char* dir);
class cmLocalVisualStudio7GeneratorInternals class cmLocalVisualStudio7GeneratorInternals
{ {
public: public:
@ -662,15 +664,20 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout,
fout << "\t\t\t\tProxyFileName=\"$(InputName)_p.c\"/>\n"; fout << "\t\t\t\tProxyFileName=\"$(InputName)_p.c\"/>\n";
// end of <Tool Name=VCMIDLTool // end of <Tool Name=VCMIDLTool
// If we are building a version 8 project file, add a flag telling the // Check if we need the FAT32 workaround.
// 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.
if ( this->Version >= 8 ) if ( this->Version >= 8 )
{ {
fout << "\t\t\t<Tool\n\t\t\t\tName=\"VCManifestTool\"\n" // Check the filesystem type where the target will be written.
<< "\t\t\t\tUseFAT32Workaround=\"true\"\n" if(cmLVS6G_IsFAT(target.GetDirectory(configName)))
<< "\t\t\t/>\n"; {
// 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<Tool\n\t\t\t\tName=\"VCManifestTool\"\n"
<< "\t\t\t\tUseFAT32Workaround=\"true\"\n"
<< "\t\t\t/>\n";
}
} }
this->OutputTargetRules(fout, configName, target, libName); this->OutputTargetRules(fout, configName, target, libName);
@ -2054,3 +2061,21 @@ GetTargetObjectFileDirectories(cmTarget* target,
dir += this->GetGlobalGenerator()->GetCMakeCFGInitDirectory(); dir += this->GetGlobalGenerator()->GetCMakeCFGInitDirectory();
dirs.push_back(dir); dirs.push_back(dir);
} }
//----------------------------------------------------------------------------
#include <windows.h>
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;
}