summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorStephen Kelly <steveire@gmail.com>2015-10-22 16:27:57 (GMT)
committerStephen Kelly <steveire@gmail.com>2015-10-24 07:19:55 (GMT)
commit459c891088c8b2fb8b7cb950878cf7c0579ddb33 (patch)
tree459c848c058f05e0d1d4e3fe8fa702b14f607d55 /Source
parent7f8bb857b8ab714b80acfa6a6e2c34195fabff6f (diff)
downloadCMake-459c891088c8b2fb8b7cb950878cf7c0579ddb33.zip
CMake-459c891088c8b2fb8b7cb950878cf7c0579ddb33.tar.gz
CMake-459c891088c8b2fb8b7cb950878cf7c0579ddb33.tar.bz2
VS10: Port to cmGeneratorTarget.
Diffstat (limited to 'Source')
-rw-r--r--Source/cmGlobalVisualStudio10Generator.cxx12
-rw-r--r--Source/cmGlobalVisualStudio10Generator.h4
-rw-r--r--Source/cmLocalVisualStudio10Generator.cxx2
-rw-r--r--Source/cmVisualStudio10TargetGenerator.cxx49
-rw-r--r--Source/cmVisualStudio10TargetGenerator.h4
5 files changed, 37 insertions, 34 deletions
diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx
index 161b532..e568704 100644
--- a/Source/cmGlobalVisualStudio10Generator.cxx
+++ b/Source/cmGlobalVisualStudio10Generator.cxx
@@ -331,7 +331,7 @@ void cmGlobalVisualStudio10Generator::Generate()
this->cmGlobalVisualStudio8Generator::Generate();
if(this->LongestSource.Length > 0)
{
- cmMakefile* mf = this->LongestSource.Target->GetMakefile();
+ cmLocalGenerator* lg = this->LongestSource.Target->GetLocalGenerator();
std::ostringstream e;
e <<
"The binary and/or source directory paths may be too long to generate "
@@ -346,13 +346,13 @@ void cmGlobalVisualStudio10Generator::Generate()
" " << this->LongestSource.SourceFile->GetFullPath() << "\n"
"This is because some Visual Studio tools would append the relative "
"path to the end of the referencing directory path, as in:\n"
- " " << mf->GetCurrentBinaryDirectory() << "/"
+ " " << lg->GetCurrentBinaryDirectory() << "/"
<< this->LongestSource.SourceRel << "\n"
"and then incorrectly complain that the file does not exist because "
"the path length is too long for some internal buffer or API. "
"To avoid this problem CMake must use a full path for this file "
"which then triggers the VS 10 property dialog bug.";
- mf->IssueMessage(cmake::WARNING, e.str().c_str());
+ lg->IssueMessage(cmake::WARNING, e.str().c_str());
}
}
@@ -591,9 +591,11 @@ cmGlobalVisualStudio10Generator
//----------------------------------------------------------------------------
void cmGlobalVisualStudio10Generator::PathTooLong(
- cmTarget* target, cmSourceFile const* sf, std::string const& sfRel)
+ cmGeneratorTarget *target, cmSourceFile const* sf,
+ std::string const& sfRel)
{
- size_t len = (strlen(target->GetMakefile()->GetCurrentBinaryDirectory()) +
+ size_t len =
+ (strlen(target->GetLocalGenerator()->GetCurrentBinaryDirectory()) +
1 + sfRel.length());
if(len > this->LongestSource.Length)
{
diff --git a/Source/cmGlobalVisualStudio10Generator.h b/Source/cmGlobalVisualStudio10Generator.h
index 7600a0d..6bf4740 100644
--- a/Source/cmGlobalVisualStudio10Generator.h
+++ b/Source/cmGlobalVisualStudio10Generator.h
@@ -95,7 +95,7 @@ public:
/** Generate an <output>.rule file path for a given command output. */
virtual std::string GenerateRuleFile(std::string const& output) const;
- void PathTooLong(cmTarget* target, cmSourceFile const* sf,
+ void PathTooLong(cmGeneratorTarget* target, cmSourceFile const* sf,
std::string const& sfRel);
virtual const char* GetToolsVersion() { return "4.0"; }
@@ -139,7 +139,7 @@ private:
{
LongestSourcePath(): Length(0), Target(0), SourceFile(0) {}
size_t Length;
- cmTarget* Target;
+ cmGeneratorTarget* Target;
cmSourceFile const* SourceFile;
std::string SourceRel;
};
diff --git a/Source/cmLocalVisualStudio10Generator.cxx b/Source/cmLocalVisualStudio10Generator.cxx
index c9d53fe..e9aee8a 100644
--- a/Source/cmLocalVisualStudio10Generator.cxx
+++ b/Source/cmLocalVisualStudio10Generator.cxx
@@ -90,7 +90,7 @@ void cmLocalVisualStudio10Generator::Generate()
else
{
cmVisualStudio10TargetGenerator tg(
- (*l)->Target, static_cast<cmGlobalVisualStudio10Generator*>(
+ *l, static_cast<cmGlobalVisualStudio10Generator*>(
this->GetGlobalGenerator()));
tg.Generate();
}
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index f4c632d..3f8e627 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -13,7 +13,6 @@
#include "cmVisualStudio10TargetGenerator.h"
#include "cmGlobalVisualStudio10Generator.h"
#include "cmGeneratorTarget.h"
-#include "cmTarget.h"
#include "cmComputeLinkInformation.h"
#include "cmGeneratedFileStream.h"
#include "cmMakefile.h"
@@ -167,13 +166,12 @@ static std::string cmVS10EscapeComment(std::string comment)
}
cmVisualStudio10TargetGenerator::
-cmVisualStudio10TargetGenerator(cmTarget* target,
+cmVisualStudio10TargetGenerator(cmGeneratorTarget* target,
cmGlobalVisualStudio10Generator* gg)
{
this->GlobalGenerator = gg;
- this->Target = target;
- this->GeneratorTarget = gg->GetGeneratorTarget(target);
- this->Makefile = target->GetMakefile();
+ this->GeneratorTarget = target;
+ this->Makefile = target->Target->GetMakefile();
this->Makefile->GetConfigurations(this->Configurations);
this->LocalGenerator =
(cmLocalVisualStudio7Generator*)
@@ -275,8 +273,9 @@ void cmVisualStudio10TargetGenerator::Generate()
return;
}
// Tell the global generator the name of the project file
- this->Target->SetProperty("GENERATOR_FILE_NAME",this->Name.c_str());
- this->Target->SetProperty("GENERATOR_FILE_NAME_EXT",
+ this->GeneratorTarget->Target
+ ->SetProperty("GENERATOR_FILE_NAME",this->Name.c_str());
+ this->GeneratorTarget->Target->SetProperty("GENERATOR_FILE_NAME_EXT",
".vcxproj");
if(this->GeneratorTarget->GetType() <= cmState::OBJECT_LIBRARY)
{
@@ -732,7 +731,8 @@ void cmVisualStudio10TargetGenerator
cmGlobalVisualStudio10Generator* gg =
static_cast<cmGlobalVisualStudio10Generator*>(this->GlobalGenerator);
const char* mfcFlag =
- this->Target->GetMakefile()->GetDefinition("CMAKE_MFC_FLAG");
+ this->GeneratorTarget->
+ Target->GetMakefile()->GetDefinition("CMAKE_MFC_FLAG");
std::string mfcFlagValue = mfcFlag ? mfcFlag : "0";
std::string useOfMfcValue = "false";
@@ -1462,7 +1462,8 @@ void cmVisualStudio10TargetGenerator::WriteSource(
}
else
{
- this->GlobalGenerator->PathTooLong(this->Target, sf, sourceRel);
+ this->GlobalGenerator->PathTooLong(this->GeneratorTarget,
+ sf, sourceRel);
}
}
this->ConvertToWindowsSlash(sourceFile);
@@ -1915,12 +1916,12 @@ bool cmVisualStudio10TargetGenerator::ComputeClOptions(
std::string baseFlagVar = "CMAKE_";
baseFlagVar += linkLanguage;
baseFlagVar += "_FLAGS";
- flags = this->
+ flags = this->GeneratorTarget->
Target->GetMakefile()->GetRequiredDefinition(baseFlagVar.c_str());
std::string flagVar = baseFlagVar + std::string("_") +
cmSystemTools::UpperCase(configName);
flags += " ";
- flags += this->
+ flags += this->GeneratorTarget->
Target->GetMakefile()->GetRequiredDefinition(flagVar.c_str());
}
// set the correct language
@@ -1936,7 +1937,8 @@ bool cmVisualStudio10TargetGenerator::ComputeClOptions(
linkLanguage, configName.c_str());
// Get preprocessor definitions for this directory.
- std::string defineFlags = this->Target->GetMakefile()->GetDefineFlags();
+ std::string defineFlags =
+ this->GeneratorTarget->Target->GetMakefile()->GetDefineFlags();
if(this->MSTools)
{
clOptions.FixExceptionHandlingDefault();
@@ -2440,11 +2442,11 @@ cmVisualStudio10TargetGenerator::ComputeLinkOptions(std::string const& config)
linkFlagVarBase += linkType;
linkFlagVarBase += "_LINKER_FLAGS";
flags += " ";
- flags += this->
+ flags += this->GeneratorTarget->
Target->GetMakefile()->GetRequiredDefinition(linkFlagVarBase.c_str());
std::string linkFlagVar = linkFlagVarBase + "_" + CONFIG;
flags += " ";
- flags += this->
+ flags += this->GeneratorTarget->
Target->GetMakefile()->GetRequiredDefinition(linkFlagVar.c_str());
const char* targetLinkFlags =
this->GeneratorTarget->GetProperty("LINK_FLAGS");
@@ -2674,7 +2676,8 @@ cmVisualStudio10TargetGenerator::WriteLinkOptions(std::string const& config)
linkOptions.OutputFlagMap(*this->BuildFileStream, " ");
this->WriteString("</Link>\n", 2);
- if(!this->GlobalGenerator->NeedLinkLibraryDependencies(*this->Target))
+ if(!this->GlobalGenerator->NeedLinkLibraryDependencies(
+ *this->GeneratorTarget->Target))
{
this->WriteString("<ProjectReference>\n", 2);
this->WriteString(
@@ -2811,7 +2814,7 @@ cmVisualStudio10TargetGenerator::WriteEvents(std::string const& configName)
{
addedPrelink = true;
std::vector<cmCustomCommand> commands =
- this->Target->GetPreLinkCommands();
+ this->GeneratorTarget->Target->GetPreLinkCommands();
this->GlobalGenerator->AddSymbolExportCommand(
this->GeneratorTarget, commands, configName);
this->WriteEvent("PreLinkEvent", commands, configName);
@@ -2820,12 +2823,12 @@ cmVisualStudio10TargetGenerator::WriteEvents(std::string const& configName)
if (!addedPrelink)
{
this->WriteEvent("PreLinkEvent",
- this->Target->GetPreLinkCommands(), configName);
+ this->GeneratorTarget->Target->GetPreLinkCommands(), configName);
}
this->WriteEvent("PreBuildEvent",
- this->Target->GetPreBuildCommands(), configName);
+ this->GeneratorTarget->Target->GetPreBuildCommands(), configName);
this->WriteEvent("PostBuildEvent",
- this->Target->GetPostBuildCommands(), configName);
+ this->GeneratorTarget->Target->GetPostBuildCommands(), configName);
}
void cmVisualStudio10TargetGenerator::WriteEvent(
@@ -2875,7 +2878,7 @@ void cmVisualStudio10TargetGenerator::WriteProjectReferences()
for( OrderedTargetDependSet::const_iterator i = depends.begin();
i != depends.end(); ++i)
{
- cmTarget const* dt = (*i)->Target;
+ cmGeneratorTarget const* dt = *i;
if(dt->GetType() == cmState::INTERFACE_LIBRARY)
{
continue;
@@ -2883,12 +2886,12 @@ void cmVisualStudio10TargetGenerator::WriteProjectReferences()
// skip fortran targets as they can not be processed by MSBuild
// the only reference will be in the .sln file
if(static_cast<cmGlobalVisualStudioGenerator*>(this->GlobalGenerator)
- ->TargetIsFortranOnly(*dt))
+ ->TargetIsFortranOnly(*dt->Target))
{
continue;
}
this->WriteString("<ProjectReference Include=\"", 2);
- cmMakefile* mf = dt->GetMakefile();
+ cmLocalGenerator* lg = dt->GetLocalGenerator();
std::string name = dt->GetName();
std::string path;
const char* p = dt->GetProperty("EXTERNAL_MSPROJECT");
@@ -2898,7 +2901,7 @@ void cmVisualStudio10TargetGenerator::WriteProjectReferences()
}
else
{
- path = mf->GetCurrentBinaryDirectory();
+ path = lg->GetCurrentBinaryDirectory();
path += "/";
path += dt->GetName();
path += ".vcxproj";
diff --git a/Source/cmVisualStudio10TargetGenerator.h b/Source/cmVisualStudio10TargetGenerator.h
index 15ed9f2..044e0dd 100644
--- a/Source/cmVisualStudio10TargetGenerator.h
+++ b/Source/cmVisualStudio10TargetGenerator.h
@@ -13,7 +13,6 @@
#define cmVisualStudioTargetGenerator_h
#include "cmStandardIncludes.h"
-class cmTarget;
class cmMakefile;
class cmGeneratorTarget;
class cmGeneratedFileStream;
@@ -29,7 +28,7 @@ struct cmIDEFlagTable;
class cmVisualStudio10TargetGenerator
{
public:
- cmVisualStudio10TargetGenerator(cmTarget* target,
+ cmVisualStudio10TargetGenerator(cmGeneratorTarget* target,
cmGlobalVisualStudio10Generator* gg);
~cmVisualStudio10TargetGenerator();
void Generate();
@@ -148,7 +147,6 @@ private:
OptionsMap LinkOptions;
std::string PathToVcxproj;
std::vector<std::string> Configurations;
- cmTarget* Target;
cmGeneratorTarget* GeneratorTarget;
cmMakefile* Makefile;
std::string Platform;