summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2014-06-05 16:56:39 (GMT)
committerBrad King <brad.king@kitware.com>2014-06-09 14:59:59 (GMT)
commit13e6d5595f4f076073e1522286f20f1a6733ad3e (patch)
tree4c72835458b1f29c267aa92b797f4e695f0b111c
parent8f4bdcc6cbc9dd3b146d4d51abf2f3b57bb6bbc8 (diff)
downloadCMake-13e6d5595f4f076073e1522286f20f1a6733ad3e.zip
CMake-13e6d5595f4f076073e1522286f20f1a6733ad3e.tar.gz
CMake-13e6d5595f4f076073e1522286f20f1a6733ad3e.tar.bz2
VS: Set some options directly instead of using flag map
Instead of passing /TC, /TP, and /STACK: as strings to be parsed through the flag map, directly set the results in the options map.
-rw-r--r--Source/cmVisualStudio10TargetGenerator.cxx31
1 files changed, 17 insertions, 14 deletions
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index 7b30e42..c2c143d 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -1147,17 +1147,18 @@ bool cmVisualStudio10TargetGenerator::OutputSourceSpecificFlags(
}
// if the source file does not match the linker language
// then force c or c++
+ const char* compileAs = 0;
if(needForceLang || (linkLanguage != lang))
{
if(lang == "CXX")
{
// force a C++ file type
- flags += " /TP ";
+ compileAs = "CompileAsCpp";
}
else if(lang == "C")
{
// force to c
- flags += " /TC ";
+ compileAs = "CompileAsC";
}
}
bool hasFlags = false;
@@ -1193,7 +1194,7 @@ bool cmVisualStudio10TargetGenerator::OutputSourceSpecificFlags(
}
// if we have flags or defines for this config then
// use them
- if(flags.size() || configDefines.size())
+ if(!flags.empty() || !configDefines.empty() || compileAs)
{
(*this->BuildFileStream ) << firstString;
firstString = ""; // only do firstString once
@@ -1202,6 +1203,10 @@ bool cmVisualStudio10TargetGenerator::OutputSourceSpecificFlags(
clOptions(this->LocalGenerator,
cmVisualStudioGeneratorOptions::Compiler,
this->GetClFlagTable(), 0, this);
+ if(compileAs)
+ {
+ clOptions.AddFlag("CompileAs", compileAs);
+ }
clOptions.Parse(flags.c_str());
clOptions.AddDefines(configDefines.c_str());
clOptions.SetConfiguration((*config).c_str());
@@ -1393,11 +1398,11 @@ bool cmVisualStudio10TargetGenerator::ComputeClOptions(
// set the correct language
if(linkLanguage == "C")
{
- flags += " /TC ";
+ clOptions.AddFlag("CompileAs", "CompileAsC");
}
if(linkLanguage == "CXX")
{
- flags += " /TP ";
+ clOptions.AddFlag("CompileAs", "CompileAsCpp");
}
this->LocalGenerator->AddCompileOptions(flags, this->Target,
linkLanguage, configName.c_str());
@@ -1571,16 +1576,7 @@ cmVisualStudio10TargetGenerator::ComputeLinkOptions(std::string const& config)
{
linkType = "EXE";
}
- std::string stackVar = "CMAKE_";
- stackVar += linkLanguage;
- stackVar += "_STACK_SIZE";
- const char* stackVal = this->Makefile->GetDefinition(stackVar.c_str());
std::string flags;
- if(stackVal)
- {
- flags += " /STACK:";
- flags += stackVal;
- }
std::string linkFlagVarBase = "CMAKE_";
linkFlagVarBase += linkType;
linkFlagVarBase += "_LINKER_FLAGS";
@@ -1666,6 +1662,13 @@ cmVisualStudio10TargetGenerator::ComputeLinkOptions(std::string const& config)
linkOptions.AddFlag("AdditionalLibraryDirectories", linkDirs.c_str());
linkOptions.AddFlag("AdditionalDependencies", libs.c_str());
linkOptions.AddFlag("Version", "");
+
+ if(const char* stackVal =
+ this->Makefile->GetDefinition("CMAKE_"+linkLanguage+"_STACK_SIZE"))
+ {
+ linkOptions.AddFlag("StackReserveSize", stackVal);
+ }
+
if(linkOptions.IsDebug() || flags.find("/debug") != flags.npos)
{
linkOptions.AddFlag("GenerateDebugInformation", "true");