[CMake] Ignore library flags now works in 2.4.8!
Sylvain Benner
benner at virtools.com
Tue Feb 19 05:33:14 EST 2008
An HTML attachment was scrubbed...
URL: http://public.kitware.com/pipermail/cmake/attachments/20080219/6c67be75/attachment.htm
-------------- next part --------------
// This is a table mapping XML tag IDE names to command line options
struct cmVS7FlagTable
{
const char* IDEName; // name used in the IDE xml file
const char* commandFlag; // command line flag
const char* comment; // comment
const char* value; // string value
};
cmVS7FlagTable cmLocalVisualStudio7GeneratorMPCompilerFlagTable[] =
{
// option flags (some flags map to the same option)
// C/C++ ----------------------------------------------------------------------------------------------
// General
{"DebugInformationFormat", "Z7", "debug format", "1"},
{"DebugInformationFormat", "Zd", "debug format", "2"},
{"DebugInformationFormat", "Zi", "debug format", "3"},
{"DebugInformationFormat", "ZI", "debug format", "4"},
{"SuppressStartupBanner", "nologo", "SuppressStartupBanner", "TRUE"},
{"SuppressStartupBanner", "logo", "Do not SuppressStartupBanner", "FALSE"},
{"WarningLevel", "W1", "Warning level", "1"},
{"WarningLevel", "W2", "Warning level", "2"},
{"WarningLevel", "W3", "Warning level", "3"},
{"WarningLevel", "W4", "Warning level", "4"},
{"Detect64BitPortabilityProblems", "noWp64", "Do not Detect 64-bit Portability Issues", "FALSE"},
{"Detect64BitPortabilityProblems", "Wp64", "Detect 64-bit Portability Issues", "TRUE"},
{"WarnAsError", "noWX", "Do not Treat warnings as errors", "FALSE"},
{"WarnAsError", "WX", "Treat warnings as errors", "TRUE"},
// Optimization
{"Optimization", "Od", "Non Debug", "0"},
{"Optimization", "O1", "Min Size", "1"},
{"Optimization", "O2", "Max Speed", "2"},
{"Optimization", "Ox", "Max Optimization", "3"},
{"GlobalOptimizations", "noOg", "Do not Global Optimizations", "FALSE"},
{"GlobalOptimizations", "Og", "Global Optimizations", "TRUE"},
{"InlineFunctionExpansion", "Ob0", "no inlines", "0"},
{"InlineFunctionExpansion", "Ob1", "when inline keyword", "1"},
{"InlineFunctionExpansion", "Ob2", "any time you can inline", "2"},
{"EnableIntrinsicFunctions", "noOi", "Do not EnableIntrinsicFunctions", "FALSE"},
{"EnableIntrinsicFunctions", "Oi", "EnableIntrinsicFunctions", "TRUE"},
{"ImproveFloatingPointConsistency", "noOp", "Do not ImproveFloatingPointConsistency", "FALSE"},
{"ImproveFloatingPointConsistency", "Op", "ImproveFloatingPointConsistency", "TRUE"},
{"FavorSizeOrSpeed", "Ot", "Favor fast code", "1"},
{"FavorSizeOrSpeed", "Os", "Favor small code", "2"},
{"OmitFramePointers", "noOy", "Do not OmitFramePointers", "FALSE"},
{"OmitFramePointers", "Oy", "OmitFramePointers", "TRUE"},
{"EnableFibreSafeOptimization", "noGT", "Don't OmitFramePointers", "FALSE"},
{"EnableFibreSafeOptimization", "GT", "OmitFramePointers", "TRUE"},
{"OptimizeForProcessor", "GB", "Blended processor mode", "0"},
{"OptimizeForProcessor", "G5", "Pentium", "1"},
{"OptimizeForProcessor", "G6", "PPro PII PIII", "2"},
{"OptimizeForProcessor", "G7", "Pentium 4 or Athlon", "3"},
{"OptimizeForWindowsApplication", "noGA", "Do not Optimize for windows", "FALSE"},
{"OptimizeForWindowsApplication", "GA", "Optimize for windows", "TRUE"},
// Code Generation
{"StringPooling", "noGF", "Disable read-only string pooling", "FALSE"},
{"StringPooling", "GF", "Enable read-only string pooling", "TRUE"},
{"MinimalRebuild", "noGm", "Do not minimal rebuild", "FALSE"},
{"MinimalRebuild", "Gm", "minimal rebuild", "TRUE"},
{"ExceptionHandling", "noEHsc2005", "Do not enable c++ exceptions", "0"},
{"ExceptionHandling", "EHsc2005", "Enable c++ exceptions", "1"},
{"ExceptionHandling", "EHa", "Enable c++ exceptions with SEH exceptions", "2"},
{"ExceptionHandling", "noEHsc", "Do not enable c++ exceptions", "FALSE"},
{"ExceptionHandling", "EHsc", "enable c++ exceptions", "TRUE"},
{"ExceptionHandling", "noGX", "Do not enable c++ exceptions", "FALSE"},
{"ExceptionHandling", "GX", "enable c++ exceptions", "TRUE"},
{"SmallerTypeCheck", "noRTCc", "Do not smaller type check", "FALSE"},
{"SmallerTypeCheck", "RTCc", "smaller type check", "TRUE"},
{"BasicRuntimeChecks", "GZ", "Stack frame checks", "1"},
{"BasicRuntimeChecks", "RTCsu", "Both stack and uninitialized checks ", "3"},
{"BasicRuntimeChecks", "RTC1", "Both stack and uninitialized checks ", "3"},
{"BasicRuntimeChecks", "RTCs", "Stack frame checks", "1"},
{"BasicRuntimeChecks", "RTCu", "Uninitialized Variables ", "2"},
{"RuntimeLibrary", "MTd", "Multithreaded debug", "1"},
{"RuntimeLibrary", "MT", "Multithreaded", "0"},
{"RuntimeLibrary", "MDd", "Multithreaded dll debug", "3"},
{"RuntimeLibrary", "MD", "Multithreaded dll", "2"},
{"RuntimeLibrary", "MLd", "Single Thread debug", "5"},
{"RuntimeLibrary", "ML", "Single Thread", "4"},
{"StructMemberAlignment", "Zp16", "struct align 16 byte ", "5"},
{"StructMemberAlignment", "Zp1", "struct align 1 byte ", "1"},
{"StructMemberAlignment", "Zp2", "struct align 2 byte ", "2"},
{"StructMemberAlignment", "Zp4", "struct align 4 byte ", "3"},
{"StructMemberAlignment", "Zp8", "struct align 8 byte ", "4"},
{"BufferSecurityCheck", "noGS", "Don't Buffer security check", "FALSE"},
{"BufferSecurityCheck", "GS", "Buffer security check", "TRUE"},
{"EnableFunctionLevelLinking", "noGy", "Do not EnableFunctionLevelLinking", "FALSE"},
{"EnableFunctionLevelLinking", "Gy", "EnableFunctionLevelLinking", "TRUE"},
{"EnableEnhancedInstructionSet", "arch:SSE2", "Use SSE2 instructions", "2"},
{"EnableEnhancedInstructionSet", "arch:SSE", "Use SSE instructions", "1"},
{"OpenMP", "openmp", "Enable OpenMP support", "TRUE"},
{"OpenMP", "noopenmp", "Do not enable OpenMP support", "FALSE"},
// Language
{"TreatWChar_tAsBuiltInType", "noZc:wchar_t", "Do not Treats wchar_t as a built-in type", "FALSE"},
{"TreatWChar_tAsBuiltInType", "Zc:wchar_t", "Treats wchar_t as a built-in type", "TRUE"},
{"ForceConformanceInForLoopScope", "noZc:forScope", "No force conform local scope in for loop", "FALSE"},
{"ForceConformanceInForLoopScope", "Zc:forScope", "force conform local scope in for loop", "TRUE"},
{"RuntimeTypeInfo", "GR-", "Turn off Run time type information for c++", "FALSE"},
{"RuntimeTypeInfo", "noGR", "Turn off Run time type information for c++", "FALSE"},
{"RuntimeTypeInfo", "GR", "Turn on Run time type information for c++", "TRUE"},
// Precompiled Headers
{"UsePrecompiledHeader", "Yc", "Create precompiled header", "1"},
{"UsePrecompiledHeader", "YX", "Automatically generate precompiled header", "2"},
{"UsePrecompiledHeader", "Yu2005", "Use precompiled header", "2"},
{"UsePrecompiledHeader", "Yu", "Use precompiled header", "3"},
// Advanced
{"ShowIncludes", "noshowIncludes", "Generates a list of include files", "FALSE"},
{"ShowIncludes", "showIncludes", "Generates a list of include files", "TRUE"},
{"CompileForArchitecture", "QRarch4", "Compile for architecture", "0"},
{"InterworkCalls", "noQRinterwork-return", "Interwork Calls", "FALSE"},
{"InterworkCalls", "QRinterwork-return", "Interwork Calls", "TRUE"},
{"CompileAs", "compileAsDefault", "Compile as default", "0"},
// Xbox 360
{"RegisterReservation", "noQVMXReserve", "VMX registers reservation", "FALSE"},
{"RegisterReservation", "QVMXReserve", "VMX registers reservation", "TRUE"},
{"TrapIntegerDivides", "noOc", "trap instructions around integer divides", "FALSE"},
{"TrapIntegerDivides", "Oc", "trap instructions around integer divides", "TRUE"},
{"Prescheduling", "noOu", "perform an additional code scheduling pass", "FALSE"},
{"Prescheduling", "Ou", "perform an additional code scheduling pass", "TRUE"},
{"InlineAssembly", "noOz", "reorder inline assembly instruction", "FALSE"},
{"InlineAssembly", "Oz", "reorder inline assembly instruction", "TRUE"},
{"Stalls", "noQXSTALLS", "listing with cycle count from pipeline emu", "FALSE"},
{"Stalls", "QXSTALLS", "listing with cycle count from pipeline emu", "TRUE"},
{"CallAttributedProfiling", "fastcap", "Call profiler around function calls", "1"},
{"CallAttributedProfiling", "callcap", "Call profiler within function calls", "2"},
{0,0,0,0 }
};
cmVS7FlagTable cmLocalVisualStudio7GeneratorMPLinkerFlagTable[] =
{
// Linker ----------------------------------------------------------------------------------------------
// General
{"LinkIncremental", "INCREMENTAL:NO", "link incremental", "1"},
{"LinkIncremental", "INCREMENTAL:YES", "link incremental", "2"},
{"LinkIncremental", "INCREMENTAL", "link incremental", "2"},
{"IgnoreImportLibrary", "NOIGNOREIMPORTLIBRARY", "IgnoreImportLibrary", "FALSE"},
{"IgnoreImportLibrary", "IGNOREIMPORTLIBRARY", "IgnoreImportLibrary", "TRUE"},
{"RegisterOutput", "NOREGISTEROUTPUT", "Register the primary output", "FALSE"},
{"RegisterOutput", "REGISTEROUTPUT", "Register the primary output", "TRUE"},
// Input
{"IgnoreDefaultLibraryNames", "NODEFAULTLIB", "default libraries to ignore", "PARAMETERS"},
{"DelayLoadDLLs", "DELAYLOAD", "delayed loading of the DLLS", "PARAMETERS"},
{"ModuleDefinitionFile", "DEF", "use specified module definition", "PARAMETERS"},
// Manifest
{"ManifestFile", "MANIFESTFILE", "specify the manifest file", "PARAMETERS"},
{"GenerateManifest", "NOMANIFEST", "linker generates a manifest", "FALSE"},
{"GenerateManifest", "MANIFEST", "linker generates a manifest", "TRUE"},
// Debugging
{"GenerateDebugInformation", "NODEBUG", "Don't Generate Debug Info", "FALSE"},
{"GenerateDebugInformation", "DEBUG", "Generate Debug Info", "TRUE"},
// System
{"SubSystem", "SUBSYSTEM:CONSOLE", "Sub system", "1"},
{"SubSystem", "SUBSYSTEM:WINDOWSCE", "Sub system", "9"},
{"SubSystem", "SUBSYSTEM:WINDOWS", "Sub system", "2"},
{"SubSystem", "SUBSYSTEM:NATIVE", "Sub system", "3"},
{"SubSystem", "SUBSYSTEM:EFI_APPLICATION", "Sub system", "4"},
{"SubSystem", "SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER", "Sub system", "5"},
{"SubSystem", "SUBSYSTEM:EFI_ROM", "Sub system", "6"},
{"SubSystem", "SUBSYSTEM:EFI_RUNTIME_DRIVER", "Sub system", "7"},
{"SubSystem", "SUBSYSTEM:POSIX", "Sub system", "8"},
// Optimization
{"OptimizeReferences", "OPT:NOREF", "Keep Unreferenced Data", "1"},
{"OptimizeReferences", "OPT:REF", "Eliminate Unreferenced Data", "2"},
{"EnableCOMDATFolding", "OPT:NOICF", "Do not Remove Redundant COMDATs", "1"},
{"EnableCOMDATFolding", "OPT:ICF", "Remove Redundant COMDATs", "2"},
// Advanced
{"TargetMachine", "MACHINE:X86", "Target Machine", "1"},
{"TargetMachine", "MACHINE:AM33", "Target Machine", "2"},
{"TargetMachine", "MACHINE:ARM", "Target Machine", "3"},
{"TargetMachine", "MACHINE:EBC", "Target Machine", "4"},
{"TargetMachine", "MACHINE:IA64", "Target Machine", "5"},
{"TargetMachine", "MACHINE:M32R", "Target Machine", "6"},
{"TargetMachine", "MACHINE:MIPS16", "Target Machine", "8"},
{"TargetMachine", "MACHINE:MIPSFPU16", "Target Machine", "10"},
{"TargetMachine", "MACHINE:MIPSFPU", "Target Machine", "9"},
{"TargetMachine", "MACHINE:MIPSR41XX", "Target Machine", "11"},
{"TargetMachine", "MACHINE:MIPS", "Target Machine", "7"},
{"TargetMachine", "MACHINE:SH3DSP", "Target Machine", "13"},
{"TargetMachine", "MACHINE:SH3", "Target Machine", "12"},
{"TargetMachine", "MACHINE:SH4", "Target Machine", "14"},
{"TargetMachine", "MACHINE:SH5", "Target Machine", "15"},
{"TargetMachine", "MACHINE:THUMB", "Target Machine", "16"},
{"TargetMachine", "MACHINE:X64", "Target Machine", "17"},
{"EntryPointSymbol", "ENTRY", "EntryPointSymbol", "PARAMETERS"},
{0,0,0,0 }
};
cmVS7FlagTable cmLocalVisualStudio7GeneratorMPXBox360ImageConversionToolFlagTable[] =
{
// XBox 360 Image Conversion ----------------------------------------------------------------------------------------------
// General
{"SuppressStartupBanner", "nologo", "suppress display of startup banner", "TRUE"},
{"SuppressStartupBanner", "logo", "display of startup banner", "FALSE"},
{"ProjectDefaults", "config", "default XEX configuration settings", "PARAMETERS"},
{"TitleID", "titleid", "title ID of the application", "PARAMETERS"},
{"LANKey", "lankey", "Key used for system link", "PARAMETERS"},
{"BaseAddress", "baseaddr", "base address of the image when loaded", "PARAMETERS"},
{"XapiHeapSize", "xapiheap", "size of default process heap at startup", "PARAMETERS"},
{"WorkspaceSize", "workspace", "Size of memory workspace for enum/sys proc", "PARAMETERS"},
{"AdditionalSections", "section", "binary res files to prod XEX image /w headers", "PARAMETERS"},
{"ExportByName", "noexportnames", "Symbol names are to be included in the executable", "FALSE"},
{"ExportByName", "exportnames", "Symbol names are to be included in the executable", "TRUE"},
{"Privilege_NoODDMapping", "privilege:2", "Does not map the optical disc drive to CdRom0:/", "TRUE"},
{"Privilege_NoODDMapping", "noprivilege:2", "Map the optical disc drive to CdRom0:/", "FALSE"},
{"Privilege_PAL50Incompatible", "privilege:10", "Specifies that the title does not support PAL50", "TRUE"},
{"Privilege_PAL50Incompatible", "noprivilege:10", "Specifies that the title supports PAL50", "FALSE"},
{0,0,0,0 }
};
void cmLocalVisualStudio7GeneratorMP::FillFlagMapFromCommandFlags(
std::map<cmStdString, cmStdString>& flagMap,
cmVS7FlagTable* flagTable,
std::string& flags)
{
std::string option;
std::string optionwithSpace;
const int POS_MAX = 65535;
int iBestPos = POS_MAX;
int iCurPos = 0;
std::string curCommand(flagTable->IDEName);
std::string value;
bool bGCC = (0 != this->Makefile->GetDefinition("USE_GCC_COMPILER"));
while(flagTable->IDEName)
{
while(flagTable->IDEName && (curCommand == flagTable->IDEName))
{
// while it's the same command, we seek the best flag to write
option.reserve(strlen(flagTable->commandFlag)+1);
optionwithSpace.reserve(strlen(flagTable->commandFlag)+2);
// first do the - version
option = "-";
option += flagTable->commandFlag;
optionwithSpace = option + " ";
// check the option with a space first
while((iCurPos = flags.find(optionwithSpace)) != flags.npos)
{
// replace the flag
cmSystemTools::ReplaceString(flags, optionwithSpace.c_str(), "");
// now put value into flag map
if (iCurPos < iBestPos)
{
value = flagTable->value;
iBestPos = iCurPos;
}
}
// now do the / version
optionwithSpace[0] = '/';
while((iCurPos = flags.find(optionwithSpace)) != flags.npos)
{
// replace the flag
cmSystemTools::ReplaceString(flags, optionwithSpace.c_str(), "");
// now put value into flag map
if (iCurPos < iBestPos)
{
value = flagTable->value;
iBestPos = iCurPos;
}
}
while((iCurPos = flags.find(option)) != flags.npos)
{
// replace the flag
cmSystemTools::ReplaceString(flags, option.c_str(), "");
// now put value into flag map
if (iCurPos < iBestPos)
{
value = flagTable->value;
iBestPos = iCurPos;
}
}
// now do the / version
option[0] = '/';
while((iCurPos = flags.find(option)) != flags.npos)
{
// replace the flag
cmSystemTools::ReplaceString(flags, option.c_str(), "");
// now put value into flag map
if (iCurPos < iBestPos)
{
value = flagTable->value;
iBestPos = iCurPos;
}
}
flagTable++;
}
if(iBestPos != POS_MAX)
{
if(0 == strcmp(value.c_str(), "PARAMETERS"))
{
// flags with parameters
int firstPos = flags.find("\"", iBestPos) + 1;
int lastPos = flags.find("\"", firstPos);
std::string parameters = flags.substr(firstPos, lastPos-firstPos);
value = parameters;
std::string stringToReplace = ":\"" + parameters + "\"";
cmSystemTools::ReplaceString(flags, stringToReplace.c_str(), "");
}
flagMap[curCommand] = value;
}
if (flagTable->IDEName)
{
curCommand = flagTable->IDEName;
iBestPos = POS_MAX;
}
}
// If verbose makefiles have been requested and the /nologo option
// was not given explicitly in the flags we want to add an attribute
// to the generated project to disable logo suppression. Otherwise
// the GUI default is to enable suppression.
if(this->Makefile->IsOn("CMAKE_VERBOSE_MAKEFILE"))
{
if(flagMap.find("SuppressStartupBanner") == flagMap.end())
{
flagMap["SuppressStartupBanner"] = "FALSE";
}
}
}
More information about the CMake
mailing list