summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Help/release/dev/FindOpenGL-target.rst5
-rw-r--r--Modules/Platform/Android.cmake9
-rw-r--r--Source/CMakeVersion.cmake2
-rw-r--r--Source/CPack/cmCPackNSISGenerator.cxx4
-rw-r--r--Source/cmComputeLinkInformation.cxx6
-rw-r--r--Source/cmGeneratorExpression.cxx5
-rw-r--r--Source/cmGeneratorExpressionEvaluator.cxx20
-rw-r--r--Source/cmGlobalVisualStudio10Generator.cxx8
-rw-r--r--Source/cmGlobalVisualStudio11Generator.cxx13
-rw-r--r--Source/cmGlobalVisualStudio12Generator.cxx8
-rw-r--r--Source/cmOrderDirectories.cxx8
-rw-r--r--Source/cmTarget.cxx2
-rw-r--r--Source/cmVisualStudio10TargetGenerator.cxx294
-rw-r--r--Source/cmVisualStudio10TargetGenerator.h6
14 files changed, 211 insertions, 179 deletions
diff --git a/Help/release/dev/FindOpenGL-target.rst b/Help/release/dev/FindOpenGL-target.rst
new file mode 100644
index 0000000..670507e
--- /dev/null
+++ b/Help/release/dev/FindOpenGL-target.rst
@@ -0,0 +1,5 @@
+FindOpenGL-target
+-----------------
+
+* The :module:`FindOpenGL` module now provides imported targets
+ ``OpenGL::GL`` and ``OpenGL::GLU`` when the libraries are found.
diff --git a/Modules/Platform/Android.cmake b/Modules/Platform/Android.cmake
new file mode 100644
index 0000000..e6d4fcf
--- /dev/null
+++ b/Modules/Platform/Android.cmake
@@ -0,0 +1,9 @@
+include(Platform/Linux)
+
+# Android has soname, but binary names must end in ".so" so we cannot append
+# a version number. Also we cannot portably represent symlinks on the host.
+set(CMAKE_PLATFORM_NO_VERSIONED_SONAME 1)
+
+# Android reportedly ignores RPATH, and we cannot predict the install
+# location anyway.
+set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "")
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake
index 34aefb4..8ea5ce5 100644
--- a/Source/CMakeVersion.cmake
+++ b/Source/CMakeVersion.cmake
@@ -1,5 +1,5 @@
# CMake version number components.
set(CMake_VERSION_MAJOR 3)
set(CMake_VERSION_MINOR 0)
-set(CMake_VERSION_PATCH 20140609)
+set(CMake_VERSION_PATCH 20140610)
#set(CMake_VERSION_RC 1)
diff --git a/Source/CPack/cmCPackNSISGenerator.cxx b/Source/CPack/cmCPackNSISGenerator.cxx
index 0113698..a5eee6b 100644
--- a/Source/CPack/cmCPackNSISGenerator.cxx
+++ b/Source/CPack/cmCPackNSISGenerator.cxx
@@ -588,8 +588,8 @@ void cmCPackNSISGenerator::CreateMenuLinks( cmOStringStream& str,
return;
}
- cmsys::RegularExpression urlRegex;
- urlRegex.compile("^(mailto:|(ftps?|https?|news)://).*$");
+ static cmsys::RegularExpression
+ urlRegex("^(mailto:|(ftps?|https?|news)://).*$");
std::vector<std::string>::iterator it;
for ( it = cpackMenuLinksVector.begin();
diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx
index ea8536f..0ce04a5 100644
--- a/Source/cmComputeLinkInformation.cxx
+++ b/Source/cmComputeLinkInformation.cxx
@@ -1811,7 +1811,7 @@ cmComputeLinkInformation::AddLibraryRuntimeInfo(std::string const& fullPath)
}
}
- is_shared_library = this->ExtractSharedLibraryName.find(file.c_str());
+ is_shared_library = this->ExtractSharedLibraryName.find(file);
if(!is_shared_library)
{
@@ -1831,8 +1831,8 @@ cmComputeLinkInformation::AddLibraryRuntimeInfo(std::string const& fullPath)
{
if(fullPath.find(".framework") != std::string::npos)
{
- cmsys::RegularExpression splitFramework;
- splitFramework.compile("^(.*)/(.*).framework/(.*)$");
+ static cmsys::RegularExpression
+ splitFramework("^(.*)/(.*).framework/(.*)$");
if(splitFramework.find(fullPath) &&
(std::string::npos !=
splitFramework.match(3).find(splitFramework.match(2))))
diff --git a/Source/cmGeneratorExpression.cxx b/Source/cmGeneratorExpression.cxx
index 028d229..2b4d955 100644
--- a/Source/cmGeneratorExpression.cxx
+++ b/Source/cmGeneratorExpression.cxx
@@ -469,12 +469,11 @@ std::string::size_type cmGeneratorExpression::Find(const std::string &input)
//----------------------------------------------------------------------------
bool cmGeneratorExpression::IsValidTargetName(const std::string &input)
{
- cmsys::RegularExpression targetNameValidator;
// The ':' is supported to allow use with IMPORTED targets. At least
// Qt 4 and 5 IMPORTED targets use ':' as the namespace delimiter.
- targetNameValidator.compile("^[A-Za-z0-9_.:+-]+$");
+ static cmsys::RegularExpression targetNameValidator("^[A-Za-z0-9_.:+-]+$");
- return targetNameValidator.find(input.c_str());
+ return targetNameValidator.find(input);
}
//----------------------------------------------------------------------------
diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx
index c54922d..7dcb335 100644
--- a/Source/cmGeneratorExpressionEvaluator.cxx
+++ b/Source/cmGeneratorExpressionEvaluator.cxx
@@ -401,9 +401,8 @@ struct CompilerIdNode : public cmGeneratorExpressionNode
{
return compilerId ? compilerId : "";
}
- cmsys::RegularExpression compilerIdValidator;
- compilerIdValidator.compile("^[A-Za-z0-9_]*$");
- if (!compilerIdValidator.find(parameters.begin()->c_str()))
+ static cmsys::RegularExpression compilerIdValidator("^[A-Za-z0-9_]*$");
+ if (!compilerIdValidator.find(*parameters.begin()))
{
reportError(context, content->GetOriginalExpression(),
"Expression syntax not recognized.");
@@ -509,9 +508,8 @@ struct CompilerVersionNode : public cmGeneratorExpressionNode
return compilerVersion ? compilerVersion : "";
}
- cmsys::RegularExpression compilerIdValidator;
- compilerIdValidator.compile("^[0-9\\.]*$");
- if (!compilerIdValidator.find(parameters.begin()->c_str()))
+ static cmsys::RegularExpression compilerIdValidator("^[0-9\\.]*$");
+ if (!compilerIdValidator.find(*parameters.begin()))
{
reportError(context, content->GetOriginalExpression(),
"Expression syntax not recognized.");
@@ -711,9 +709,8 @@ static const struct ConfigurationTestNode : public cmGeneratorExpressionNode
{
return configurationNode.Evaluate(parameters, context, content, 0);
}
- cmsys::RegularExpression configValidator;
- configValidator.compile("^[A-Za-z0-9_]*$");
- if (!configValidator.find(parameters.begin()->c_str()))
+ static cmsys::RegularExpression configValidator("^[A-Za-z0-9_]*$");
+ if (!configValidator.find(*parameters.begin()))
{
reportError(context, content->GetOriginalExpression(),
"Expression syntax not recognized.");
@@ -884,8 +881,7 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode
"$<TARGET_PROPERTY:...> expression requires one or two parameters");
return std::string();
}
- cmsys::RegularExpression propertyNameValidator;
- propertyNameValidator.compile("^[A-Za-z0-9_]+$");
+ static cmsys::RegularExpression propertyNameValidator("^[A-Za-z0-9_]+$");
cmTarget const* target = context->HeadTarget;
std::string propertyName = *parameters.begin();
@@ -973,7 +969,7 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode
return std::string();
}
- if (!propertyNameValidator.find(propertyName.c_str()))
+ if (!propertyNameValidator.find(propertyName))
{
::reportError(context, content->GetOriginalExpression(),
"Property name not supported.");
diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx
index 86d0de3..a6d1c31 100644
--- a/Source/cmGlobalVisualStudio10Generator.cxx
+++ b/Source/cmGlobalVisualStudio10Generator.cxx
@@ -48,17 +48,19 @@ public:
const char* p = cmVS10GenName(name, genName);
if(!p)
{ return 0; }
- if(strcmp(p, "") == 0)
+ if(!*p)
{
return new cmGlobalVisualStudio10Generator(
genName, "", "");
}
- if(strcmp(p, " Win64") == 0)
+ if(*p++ != ' ')
+ { return 0; }
+ if(strcmp(p, "Win64") == 0)
{
return new cmGlobalVisualStudio10Generator(
genName, "x64", "CMAKE_FORCE_WIN64");
}
- if(strcmp(p, " IA64") == 0)
+ if(strcmp(p, "IA64") == 0)
{
return new cmGlobalVisualStudio10Generator(
genName, "Itanium", "CMAKE_FORCE_IA64");
diff --git a/Source/cmGlobalVisualStudio11Generator.cxx b/Source/cmGlobalVisualStudio11Generator.cxx
index 7033f2a..fa134fc 100644
--- a/Source/cmGlobalVisualStudio11Generator.cxx
+++ b/Source/cmGlobalVisualStudio11Generator.cxx
@@ -43,27 +43,24 @@ public:
const char* p = cmVS11GenName(name, genName);
if(!p)
{ return 0; }
- if(strcmp(p, "") == 0)
+ if(!*p)
{
return new cmGlobalVisualStudio11Generator(
genName, "", "");
}
- if(strcmp(p, " Win64") == 0)
+ if(*p++ != ' ')
+ { return 0; }
+ if(strcmp(p, "Win64") == 0)
{
return new cmGlobalVisualStudio11Generator(
genName, "x64", "CMAKE_FORCE_WIN64");
}
- if(strcmp(p, " ARM") == 0)
+ if(strcmp(p, "ARM") == 0)
{
return new cmGlobalVisualStudio11Generator(
genName, "ARM", "");
}
- if(*p++ != ' ')
- {
- return 0;
- }
-
std::set<std::string> installedSDKs =
cmGlobalVisualStudio11Generator::GetInstalledWindowsCESDKs();
diff --git a/Source/cmGlobalVisualStudio12Generator.cxx b/Source/cmGlobalVisualStudio12Generator.cxx
index 40f8b05..698624d 100644
--- a/Source/cmGlobalVisualStudio12Generator.cxx
+++ b/Source/cmGlobalVisualStudio12Generator.cxx
@@ -43,17 +43,19 @@ public:
const char* p = cmVS12GenName(name, genName);
if(!p)
{ return 0; }
- if(strcmp(p, "") == 0)
+ if(!*p)
{
return new cmGlobalVisualStudio12Generator(
genName, "", "");
}
- if(strcmp(p, " Win64") == 0)
+ if(*p++ != ' ')
+ { return 0; }
+ if(strcmp(p, "Win64") == 0)
{
return new cmGlobalVisualStudio12Generator(
genName, "x64", "CMAKE_FORCE_WIN64");
}
- if(strcmp(p, " ARM") == 0)
+ if(strcmp(p, "ARM") == 0)
{
return new cmGlobalVisualStudio12Generator(
genName, "ARM", "");
diff --git a/Source/cmOrderDirectories.cxx b/Source/cmOrderDirectories.cxx
index ec671fc..71a3497 100644
--- a/Source/cmOrderDirectories.cxx
+++ b/Source/cmOrderDirectories.cxx
@@ -39,8 +39,8 @@ public:
if(file.rfind(".framework") != std::string::npos)
{
- cmsys::RegularExpression splitFramework;
- splitFramework.compile("^(.*)/(.*).framework/(.*)$");
+ static cmsys::RegularExpression
+ splitFramework("^(.*)/(.*).framework/(.*)$");
if(splitFramework.find(file) &&
(std::string::npos !=
splitFramework.match(3).find(splitFramework.match(2))))
@@ -326,8 +326,8 @@ void cmOrderDirectories::AddRuntimeLibrary(std::string const& fullPath,
if(fullPath.rfind(".framework") != std::string::npos)
{
- cmsys::RegularExpression splitFramework;
- splitFramework.compile("^(.*)/(.*).framework/(.*)$");
+ static cmsys::RegularExpression
+ splitFramework("^(.*)/(.*).framework/(.*)$");
if(splitFramework.find(fullPath) &&
(std::string::npos !=
splitFramework.match(3).find(splitFramework.match(2))))
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index 59cc14c..01edde9 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -4320,6 +4320,7 @@ void cmTarget::GetLibraryNames(std::string& name,
const char* version = this->GetProperty("VERSION");
const char* soversion = this->GetProperty("SOVERSION");
if(!this->HasSOName(config) ||
+ this->Makefile->IsOn("CMAKE_PLATFORM_NO_VERSIONED_SONAME") ||
this->IsFrameworkOnApple())
{
// Versioning is supported only for shared libraries and modules,
@@ -6145,7 +6146,6 @@ void processILibs(const std::string& config,
if (emitted.insert(tgt).second)
{
tgts.push_back(tgt);
- std::vector<std::string> ilibs;
cmTarget::LinkInterface const* iface =
tgt->GetLinkInterfaceLibraries(config, headTarget);
if (iface)
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index 72bb020..acf3930 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -32,34 +32,37 @@
#include <cmsys/auto_ptr.hxx>
-static cmVS7FlagTable const*
-cmVSGetCLFlagTable(cmLocalVisualStudioGenerator* lg)
+cmIDEFlagTable const* cmVisualStudio10TargetGenerator::GetClFlagTable() const
{
- if(lg->GetVersion() >= cmLocalVisualStudioGenerator::VS12)
+ cmLocalVisualStudioGenerator::VSVersion
+ v = this->LocalGenerator->GetVersion();
+ if(v >= cmLocalVisualStudioGenerator::VS12)
{ return cmVS12CLFlagTable; }
- else if(lg->GetVersion() == cmLocalVisualStudioGenerator::VS11)
+ else if(v == cmLocalVisualStudioGenerator::VS11)
{ return cmVS11CLFlagTable; }
else
{ return cmVS10CLFlagTable; }
}
-static cmVS7FlagTable const*
-cmVSGetLibFlagTable(cmLocalVisualStudioGenerator* lg)
+cmIDEFlagTable const* cmVisualStudio10TargetGenerator::GetLibFlagTable() const
{
- if(lg->GetVersion() >= cmLocalVisualStudioGenerator::VS12)
+ cmLocalVisualStudioGenerator::VSVersion
+ v = this->LocalGenerator->GetVersion();
+ if(v >= cmLocalVisualStudioGenerator::VS12)
{ return cmVS12LibFlagTable; }
- else if(lg->GetVersion() == cmLocalVisualStudioGenerator::VS11)
+ else if(v == cmLocalVisualStudioGenerator::VS11)
{ return cmVS11LibFlagTable; }
else
{ return cmVS10LibFlagTable; }
}
-static cmVS7FlagTable const*
-cmVSGetLinkFlagTable(cmLocalVisualStudioGenerator* lg)
+cmIDEFlagTable const* cmVisualStudio10TargetGenerator::GetLinkFlagTable() const
{
- if(lg->GetVersion() >= cmLocalVisualStudioGenerator::VS12)
+ cmLocalVisualStudioGenerator::VSVersion
+ v = this->LocalGenerator->GetVersion();
+ if(v >= cmLocalVisualStudioGenerator::VS12)
{ return cmVS12LinkFlagTable; }
- else if(lg->GetVersion() == cmLocalVisualStudioGenerator::VS11)
+ else if(v == cmLocalVisualStudioGenerator::VS11)
{ return cmVS11LinkFlagTable; }
else
{ return cmVS10LinkFlagTable; }
@@ -464,8 +467,6 @@ void cmVisualStudio10TargetGenerator::WriteProjectConfigurations()
void cmVisualStudio10TargetGenerator::WriteProjectConfigurationValues()
{
- cmGlobalVisualStudio10Generator* gg =
- static_cast<cmGlobalVisualStudio10Generator*>(this->GlobalGenerator);
std::vector<std::string> *configs =
static_cast<cmGlobalVisualStudio7Generator *>
(this->GlobalGenerator)->GetConfigurations();
@@ -500,52 +501,61 @@ void cmVisualStudio10TargetGenerator::WriteProjectConfigurationValues()
configType += "</ConfigurationType>\n";
this->WriteString(configType.c_str(), 2);
- const char* mfcFlag =
- this->Target->GetMakefile()->GetDefinition("CMAKE_MFC_FLAG");
- std::string mfcFlagValue = mfcFlag ? mfcFlag : "0";
+ this->WriteMSToolConfigurationValues(*i);
- std::string useOfMfcValue = "false";
- if(mfcFlagValue == "1")
- {
- useOfMfcValue = "Static";
- }
- else if(mfcFlagValue == "2")
- {
- useOfMfcValue = "Dynamic";
- }
- std::string mfcLine = "<UseOfMfc>";
- mfcLine += useOfMfcValue + "</UseOfMfc>\n";
- this->WriteString(mfcLine.c_str(), 2);
+ this->WriteString("</PropertyGroup>\n", 1);
+ }
+}
- if((this->Target->GetType() <= cmTarget::OBJECT_LIBRARY &&
- this->ClOptions[*i]->UsingUnicode()) ||
- this->Target->GetPropertyAsBool("VS_WINRT_EXTENSIONS"))
- {
- this->WriteString("<CharacterSet>Unicode</CharacterSet>\n", 2);
- }
- else if (this->Target->GetType() <= cmTarget::MODULE_LIBRARY &&
- this->ClOptions[*i]->UsingSBCS())
- {
- this->WriteString("<CharacterSet>NotSet</CharacterSet>\n", 2);
- }
- else
- {
- this->WriteString("<CharacterSet>MultiByte</CharacterSet>\n", 2);
- }
- if(const char* toolset = gg->GetPlatformToolset())
- {
- std::string pts = "<PlatformToolset>";
- pts += toolset;
- pts += "</PlatformToolset>\n";
- this->WriteString(pts.c_str(), 2);
- }
- if(this->Target->GetPropertyAsBool("VS_WINRT_EXTENSIONS"))
- {
- this->WriteString("<WindowsAppContainer>true"
- "</WindowsAppContainer>\n", 2);
- }
+//----------------------------------------------------------------------------
+void cmVisualStudio10TargetGenerator
+::WriteMSToolConfigurationValues(std::string const& config)
+{
+ cmGlobalVisualStudio10Generator* gg =
+ static_cast<cmGlobalVisualStudio10Generator*>(this->GlobalGenerator);
+ const char* mfcFlag =
+ this->Target->GetMakefile()->GetDefinition("CMAKE_MFC_FLAG");
+ std::string mfcFlagValue = mfcFlag ? mfcFlag : "0";
- this->WriteString("</PropertyGroup>\n", 1);
+ std::string useOfMfcValue = "false";
+ if(mfcFlagValue == "1")
+ {
+ useOfMfcValue = "Static";
+ }
+ else if(mfcFlagValue == "2")
+ {
+ useOfMfcValue = "Dynamic";
+ }
+ std::string mfcLine = "<UseOfMfc>";
+ mfcLine += useOfMfcValue + "</UseOfMfc>\n";
+ this->WriteString(mfcLine.c_str(), 2);
+
+ if((this->Target->GetType() <= cmTarget::OBJECT_LIBRARY &&
+ this->ClOptions[config]->UsingUnicode()) ||
+ this->Target->GetPropertyAsBool("VS_WINRT_EXTENSIONS"))
+ {
+ this->WriteString("<CharacterSet>Unicode</CharacterSet>\n", 2);
+ }
+ else if (this->Target->GetType() <= cmTarget::MODULE_LIBRARY &&
+ this->ClOptions[config]->UsingSBCS())
+ {
+ this->WriteString("<CharacterSet>NotSet</CharacterSet>\n", 2);
+ }
+ else
+ {
+ this->WriteString("<CharacterSet>MultiByte</CharacterSet>\n", 2);
+ }
+ if(const char* toolset = gg->GetPlatformToolset())
+ {
+ std::string pts = "<PlatformToolset>";
+ pts += toolset;
+ pts += "</PlatformToolset>\n";
+ this->WriteString(pts.c_str(), 2);
+ }
+ if(this->Target->GetPropertyAsBool("VS_WINRT_EXTENSIONS"))
+ {
+ this->WriteString("<WindowsAppContainer>true"
+ "</WindowsAppContainer>\n", 2);
}
}
@@ -1144,17 +1154,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;
@@ -1190,7 +1201,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
@@ -1198,7 +1209,11 @@ bool cmVisualStudio10TargetGenerator::OutputSourceSpecificFlags(
cmVisualStudioGeneratorOptions
clOptions(this->LocalGenerator,
cmVisualStudioGeneratorOptions::Compiler,
- cmVSGetCLFlagTable(this->LocalGenerator), 0, this);
+ 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());
@@ -1260,23 +1275,28 @@ void cmVisualStudio10TargetGenerator::WritePathAndIncrementalLinkOptions()
this->ConvertToWindowsSlash(outDir);
this->WritePlatformConfigTag("OutDir", config->c_str(), 3);
- *this->BuildFileStream << outDir
+ *this->BuildFileStream << cmVS10EscapeXML(outDir)
<< "</OutDir>\n";
this->WritePlatformConfigTag("IntDir", config->c_str(), 3);
- *this->BuildFileStream << intermediateDir
+ *this->BuildFileStream << cmVS10EscapeXML(intermediateDir)
<< "</IntDir>\n";
+ std::string name =
+ cmSystemTools::GetFilenameWithoutLastExtension(targetNameFull);
this->WritePlatformConfigTag("TargetName", config->c_str(), 3);
- *this->BuildFileStream
- << cmSystemTools::GetFilenameWithoutLastExtension(
- targetNameFull.c_str())
- << "</TargetName>\n";
+ *this->BuildFileStream << cmVS10EscapeXML(name) << "</TargetName>\n";
+ std::string ext =
+ cmSystemTools::GetFilenameLastExtension(targetNameFull);
+ if(ext.empty())
+ {
+ // An empty TargetExt causes a default extension to be used.
+ // A single "." appears to be treated as an empty extension.
+ ext = ".";
+ }
this->WritePlatformConfigTag("TargetExt", config->c_str(), 3);
- *this->BuildFileStream
- << cmSystemTools::GetFilenameLastExtension(targetNameFull.c_str())
- << "</TargetExt>\n";
+ *this->BuildFileStream << cmVS10EscapeXML(ext) << "</TargetExt>\n";
this->OutputLinkIncremental(*config);
}
@@ -1355,48 +1375,44 @@ bool cmVisualStudio10TargetGenerator::ComputeClOptions(
cmsys::auto_ptr<Options> pOptions(
new Options(this->LocalGenerator, Options::Compiler,
- cmVSGetCLFlagTable(this->LocalGenerator)));
+ this->GetClFlagTable()));
Options& clOptions = *pOptions;
std::string flags;
- // collect up flags for
- if(this->Target->GetType() < cmTarget::UTILITY)
+ const std::string& linkLanguage =
+ this->Target->GetLinkerLanguage(configName.c_str());
+ if(linkLanguage.empty())
{
- const std::string& linkLanguage =
- this->Target->GetLinkerLanguage(configName.c_str());
- if(linkLanguage.empty())
- {
- cmSystemTools::Error
- ("CMake can not determine linker language for target: ",
- this->Name.c_str());
- return false;
- }
- if(linkLanguage == "C" || linkLanguage == "CXX"
- || linkLanguage == "Fortran")
- {
- std::string baseFlagVar = "CMAKE_";
- baseFlagVar += linkLanguage;
- baseFlagVar += "_FLAGS";
- flags = this->
- Target->GetMakefile()->GetRequiredDefinition(baseFlagVar.c_str());
- std::string flagVar = baseFlagVar + std::string("_") +
- cmSystemTools::UpperCase(configName);
- flags += " ";
- flags += this->
- Target->GetMakefile()->GetRequiredDefinition(flagVar.c_str());
- }
- // set the correct language
- if(linkLanguage == "C")
- {
- flags += " /TC ";
- }
- if(linkLanguage == "CXX")
- {
- flags += " /TP ";
- }
- this->LocalGenerator->AddCompileOptions(flags, this->Target,
- linkLanguage, configName.c_str());
+ cmSystemTools::Error
+ ("CMake can not determine linker language for target: ",
+ this->Name.c_str());
+ return false;
+ }
+ if(linkLanguage == "C" || linkLanguage == "CXX"
+ || linkLanguage == "Fortran")
+ {
+ std::string baseFlagVar = "CMAKE_";
+ baseFlagVar += linkLanguage;
+ baseFlagVar += "_FLAGS";
+ flags = this->
+ Target->GetMakefile()->GetRequiredDefinition(baseFlagVar.c_str());
+ std::string flagVar = baseFlagVar + std::string("_") +
+ cmSystemTools::UpperCase(configName);
+ flags += " ";
+ flags += this->
+ Target->GetMakefile()->GetRequiredDefinition(flagVar.c_str());
+ }
+ // set the correct language
+ if(linkLanguage == "C")
+ {
+ clOptions.AddFlag("CompileAs", "CompileAsC");
}
+ if(linkLanguage == "CXX")
+ {
+ clOptions.AddFlag("CompileAs", "CompileAsCpp");
+ }
+ this->LocalGenerator->AddCompileOptions(flags, this->Target,
+ linkLanguage, configName.c_str());
// Get preprocessor definitions for this directory.
std::string defineFlags = this->Target->GetMakefile()->GetDefineFlags();
@@ -1436,6 +1452,10 @@ void cmVisualStudio10TargetGenerator::WriteClOptions(
clOptions.OutputAdditionalOptions(*this->BuildFileStream, " ", "");
this->OutputIncludes(includes);
clOptions.OutputFlagMap(*this->BuildFileStream, " ");
+ clOptions.OutputPreprocessorDefinitions(*this->BuildFileStream, " ",
+ "\n", "CXX");
+
+ this->WriteString("<ObjectFileName>$(IntDir)</ObjectFileName>\n", 3);
// If not in debug mode, write the DebugInformationFormat field
// without value so PDBs don't get generated uselessly.
@@ -1445,10 +1465,6 @@ void cmVisualStudio10TargetGenerator::WriteClOptions(
"</DebugInformationFormat>\n", 3);
}
- clOptions.OutputPreprocessorDefinitions(*this->BuildFileStream, " ",
- "\n", "CXX");
- this->WriteString("<ObjectFileName>$(IntDir)</ObjectFileName>\n", 3);
-
// Specify the compiler program database file if configured.
std::string pdb = this->Target->GetCompilePDBPath(configName.c_str());
if(!pdb.empty())
@@ -1508,7 +1524,7 @@ cmVisualStudio10TargetGenerator::WriteLibOptions(std::string const& config)
cmVisualStudioGeneratorOptions
libOptions(this->LocalGenerator,
cmVisualStudioGeneratorOptions::Linker,
- cmVSGetLibFlagTable(this->LocalGenerator), 0, this);
+ this->GetLibFlagTable(), 0, this);
libOptions.Parse(libflags.c_str());
libOptions.OutputAdditionalOptions(*this->BuildFileStream, " ", "");
libOptions.OutputFlagMap(*this->BuildFileStream, " ");
@@ -1543,7 +1559,7 @@ cmVisualStudio10TargetGenerator::ComputeLinkOptions(std::string const& config)
{
cmsys::auto_ptr<Options> pOptions(
new Options(this->LocalGenerator, Options::Linker,
- cmVSGetLinkFlagTable(this->LocalGenerator), 0, this));
+ this->GetLinkFlagTable(), 0, this));
Options& linkOptions = *pOptions;
const std::string& linkLanguage =
@@ -1567,16 +1583,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";
@@ -1600,14 +1607,6 @@ cmVisualStudio10TargetGenerator::ComputeLinkOptions(std::string const& config)
flags += " ";
flags += flagsConfig;
}
- if ( this->Target->GetPropertyAsBool("WIN32_EXECUTABLE") )
- {
- linkOptions.AddFlag("SubSystem", "Windows");
- }
- else
- {
- linkOptions.AddFlag("SubSystem", "Console");
- }
std::string standardLibsVar = "CMAKE_";
standardLibsVar += linkLanguage;
standardLibsVar += "_STANDARD_LIBRARIES";
@@ -1661,15 +1660,7 @@ cmVisualStudio10TargetGenerator::ComputeLinkOptions(std::string const& config)
linkDirs += "%(AdditionalLibraryDirectories)";
linkOptions.AddFlag("AdditionalLibraryDirectories", linkDirs.c_str());
linkOptions.AddFlag("AdditionalDependencies", libs.c_str());
- linkOptions.AddFlag("Version", "");
- if(linkOptions.IsDebug() || flags.find("/debug") != flags.npos)
- {
- linkOptions.AddFlag("GenerateDebugInformation", "true");
- }
- else
- {
- linkOptions.AddFlag("GenerateDebugInformation", "false");
- }
+
std::string targetName;
std::string targetNameSO;
std::string targetNameFull;
@@ -1688,6 +1679,31 @@ cmVisualStudio10TargetGenerator::ComputeLinkOptions(std::string const& config)
config.c_str());
}
+ linkOptions.AddFlag("Version", "");
+
+ if ( this->Target->GetPropertyAsBool("WIN32_EXECUTABLE") )
+ {
+ linkOptions.AddFlag("SubSystem", "Windows");
+ }
+ else
+ {
+ linkOptions.AddFlag("SubSystem", "Console");
+ }
+
+ 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");
+ }
+ else
+ {
+ linkOptions.AddFlag("GenerateDebugInformation", "false");
+ }
std::string pdb = this->Target->GetPDBDirectory(config.c_str());
pdb += "/";
pdb += targetNamePDB;
diff --git a/Source/cmVisualStudio10TargetGenerator.h b/Source/cmVisualStudio10TargetGenerator.h
index d72c6fd..8f2faca 100644
--- a/Source/cmVisualStudio10TargetGenerator.h
+++ b/Source/cmVisualStudio10TargetGenerator.h
@@ -23,6 +23,7 @@ class cmCustomCommand;
class cmLocalVisualStudio7Generator;
class cmComputeLinkInformation;
class cmVisualStudioGeneratorOptions;
+struct cmIDEFlagTable;
#include "cmSourceGroup.h"
class cmVisualStudio10TargetGenerator
@@ -55,6 +56,7 @@ private:
void WriteString(const char* line, int indentLevel);
void WriteProjectConfigurations();
void WriteProjectConfigurationValues();
+ void WriteMSToolConfigurationValues(std::string const& config);
void WriteSource(const char* tool, cmSourceFile const* sf,
const char* end = 0);
void WriteSources(const char* tool,
@@ -98,6 +100,10 @@ private:
const std::vector<cmSourceGroup>& allGroups);
bool IsResxHeader(const std::string& headerFile);
+ cmIDEFlagTable const* GetClFlagTable() const;
+ cmIDEFlagTable const* GetLibFlagTable() const;
+ cmIDEFlagTable const* GetLinkFlagTable() const;
+
private:
typedef cmVisualStudioGeneratorOptions Options;
typedef std::map<std::string, Options*> OptionsMap;