Browse Source

Generators: Use GetType from the cmGeneratorTarget.

Stephen Kelly 10 năm trước cách đây
mục cha
commit
983c00f8f9

+ 3 - 3
Source/cmComputeLinkInformation.cxx

@@ -290,7 +290,7 @@ cmComputeLinkInformation
   // the program that will load it.
   this->LoaderFlag = 0;
   if(!this->UseImportLibrary &&
-     this->Target->Target->GetType() == cmTarget::MODULE_LIBRARY)
+     this->Target->GetType() == cmTarget::MODULE_LIBRARY)
     {
     std::string loader_flag_var = "CMAKE_SHARED_MODULE_LOADER_";
     loader_flag_var += this->LinkLanguage;
@@ -308,10 +308,10 @@ cmComputeLinkInformation
 
   // Get options needed to specify RPATHs.
   this->RuntimeUseChrpath = false;
-  if(this->Target->Target->GetType() != cmTarget::STATIC_LIBRARY)
+  if(this->Target->GetType() != cmTarget::STATIC_LIBRARY)
     {
     const char* tType =
-      ((this->Target->Target->GetType() == cmTarget::EXECUTABLE)?
+      ((this->Target->GetType() == cmTarget::EXECUTABLE)?
        "EXECUTABLE" : "SHARED_LIBRARY");
     std::string rtVar = "CMAKE_";
     rtVar += tType;

+ 2 - 1
Source/cmComputeTargetDepends.cxx

@@ -554,7 +554,8 @@ cmComputeTargetDepends
 
     // Describe the depender.
     e << "  \"" << depender->GetName() << "\" of type "
-      << cmTarget::GetTargetTypeName(depender->Target->GetType()) << "\n";
+      << cmTarget::GetTargetTypeName(
+           (cmTarget::TargetType)depender->GetType()) << "\n";
 
     // List its dependencies that are inside the component.
     EdgeList const& nl = this->InitialGraph[i];

+ 1 - 1
Source/cmGeneratorExpressionNode.cxx

@@ -1632,7 +1632,7 @@ struct TargetFilesystemArtifactResultCreator<ArtifactPdbTag>
       return std::string();
       }
 
-    cmTarget::TargetType targetType = target->Target->GetType();
+    cmTarget::TargetType targetType = (cmTarget::TargetType)target->GetType();
 
     if(targetType != cmTarget::SHARED_LIBRARY &&
        targetType != cmTarget::MODULE_LIBRARY &&

+ 10 - 10
Source/cmGeneratorTarget.cxx

@@ -1965,7 +1965,7 @@ cmGeneratorTarget::CompileInfo const* cmGeneratorTarget::GetCompileInfo(
     std::string msg = "cmTarget::GetCompileInfo called for ";
     msg += this->GetName();
     msg += " which has type ";
-    msg += cmTarget::GetTargetTypeName(this->Target->GetType());
+    msg += cmTarget::GetTargetTypeName((cmTarget::TargetType)this->GetType());
     this->LocalGenerator->IssueMessage(cmake::INTERNAL_ERROR, msg);
     return 0;
     }
@@ -2155,7 +2155,7 @@ cmTargetTraceDependencies
   this->CurrentEntry = 0;
 
   // Queue all the source files already specified for the target.
-  if (this->Target->GetType() != cmTarget::INTERFACE_LIBRARY)
+  if (target->GetType() != cmTarget::INTERFACE_LIBRARY)
     {
     std::vector<std::string> configs;
     this->Makefile->GetConfigurations(configs);
@@ -3657,8 +3657,8 @@ cmGeneratorTarget::GetCompatibleInterfaces(std::string const& config) const
 bool cmGeneratorTarget::IsLinkInterfaceDependentBoolProperty(
     const std::string &p, const std::string& config) const
 {
-  if (this->Target->GetType() == cmTarget::OBJECT_LIBRARY
-      || this->Target->GetType() == cmTarget::INTERFACE_LIBRARY)
+  if (this->GetType() == cmTarget::OBJECT_LIBRARY
+      || this->GetType() == cmTarget::INTERFACE_LIBRARY)
     {
     return false;
     }
@@ -3669,8 +3669,8 @@ bool cmGeneratorTarget::IsLinkInterfaceDependentBoolProperty(
 bool cmGeneratorTarget::IsLinkInterfaceDependentStringProperty(
     const std::string &p, const std::string& config) const
 {
-  if (this->Target->GetType() == cmTarget::OBJECT_LIBRARY
-      || this->Target->GetType() == cmTarget::INTERFACE_LIBRARY)
+  if (this->GetType() == cmTarget::OBJECT_LIBRARY
+      || this->GetType() == cmTarget::INTERFACE_LIBRARY)
     {
     return false;
     }
@@ -3681,8 +3681,8 @@ bool cmGeneratorTarget::IsLinkInterfaceDependentStringProperty(
 bool cmGeneratorTarget::IsLinkInterfaceDependentNumberMinProperty(
     const std::string &p, const std::string& config) const
 {
-  if (this->Target->GetType() == cmTarget::OBJECT_LIBRARY
-      || this->Target->GetType() == cmTarget::INTERFACE_LIBRARY)
+  if (this->GetType() == cmTarget::OBJECT_LIBRARY
+      || this->GetType() == cmTarget::INTERFACE_LIBRARY)
     {
     return false;
     }
@@ -3693,8 +3693,8 @@ bool cmGeneratorTarget::IsLinkInterfaceDependentNumberMinProperty(
 bool cmGeneratorTarget::IsLinkInterfaceDependentNumberMaxProperty(
     const std::string &p, const std::string& config) const
 {
-  if (this->Target->GetType() == cmTarget::OBJECT_LIBRARY
-      || this->Target->GetType() == cmTarget::INTERFACE_LIBRARY)
+  if (this->GetType() == cmTarget::OBJECT_LIBRARY
+      || this->GetType() == cmTarget::INTERFACE_LIBRARY)
     {
     return false;
     }

+ 3 - 3
Source/cmGhsMultiTargetGenerator.cxx

@@ -148,7 +148,7 @@ void cmGhsMultiTargetGenerator::Generate()
     this->WriteCompilerFlags(config, language);
     this->WriteCompilerDefinitions(config, language);
     this->WriteIncludes(config, language);
-    if (this->Target->GetType() == cmTarget::EXECUTABLE)
+    if (this->GeneratorTarget->GetType() == cmTarget::EXECUTABLE)
       {
       this->WriteTargetLinkLibraries();
       }
@@ -215,13 +215,13 @@ void cmGhsMultiTargetGenerator::WriteTypeSpecifics(const std::string &config,
   std::string outputDir(this->GetOutputDirectory(config));
   std::string outputFilename(this->GetOutputFilename(config));
 
-  if (this->Target->GetType() == cmTarget::STATIC_LIBRARY)
+  if (this->GeneratorTarget->GetType() == cmTarget::STATIC_LIBRARY)
     {
     *this->GetFolderBuildStreams() << "    {optgroup=GhsCommonOptions} -o \""
                                    << outputDir << outputFilename << ".a\""
                                    << std::endl;
     }
-  else if (this->Target->GetType() == cmTarget::EXECUTABLE)
+  else if (this->GeneratorTarget->GetType() == cmTarget::EXECUTABLE)
     {
     if (notKernel && !this->IsTargetGroup())
       {

+ 2 - 2
Source/cmLocalGenerator.cxx

@@ -137,7 +137,7 @@ void cmLocalGenerator::TraceDependencies()
       t != targets.end(); ++t)
     {
     if (t->second->Target->IsImported()
-        || t->second->Target->GetType() == cmTarget::INTERFACE_LIBRARY)
+        || t->second->GetType() == cmTarget::INTERFACE_LIBRARY)
       {
       continue;
       }
@@ -472,7 +472,7 @@ void cmLocalGenerator::ComputeTargetManifest()
       t != targets.end(); ++t)
     {
     cmGeneratorTarget& target = *t->second;
-    if (target.Target->GetType() == cmTarget::INTERFACE_LIBRARY)
+    if (target.GetType() == cmTarget::INTERFACE_LIBRARY)
       {
       continue;
       }

+ 1 - 1
Source/cmLocalGhsMultiGenerator.cxx

@@ -31,7 +31,7 @@ void cmLocalGhsMultiGenerator::Generate()
   for (cmGeneratorTargetsType::iterator l = tgts.begin(); l != tgts.end();
        ++l)
     {
-    if (l->second->Target->GetType() == cmTarget::INTERFACE_LIBRARY
+    if (l->second->GetType() == cmTarget::INTERFACE_LIBRARY
         || l->second->Target->IsImported())
       {
       continue;

+ 1 - 1
Source/cmLocalNinjaGenerator.cxx

@@ -77,7 +77,7 @@ void cmLocalNinjaGenerator::Generate()
   for(cmGeneratorTargetsType::iterator t = targets.begin();
       t != targets.end(); ++t)
     {
-    if (t->second->Target->GetType() == cmTarget::INTERFACE_LIBRARY
+    if (t->second->GetType() == cmTarget::INTERFACE_LIBRARY
         || t->second->Target->IsImported())
       {
       continue;

+ 1 - 1
Source/cmLocalUnixMakefileGenerator3.cxx

@@ -119,7 +119,7 @@ void cmLocalUnixMakefileGenerator3::Generate()
   for(cmGeneratorTargetsType::iterator t = targets.begin();
       t != targets.end(); ++t)
     {
-    if (t->second->Target->GetType() == cmTarget::INTERFACE_LIBRARY
+    if (t->second->GetType() == cmTarget::INTERFACE_LIBRARY
         || t->second->Target->IsImported())
       {
       continue;

+ 12 - 12
Source/cmMakefileLibraryTargetGenerator.cxx

@@ -26,7 +26,7 @@ cmMakefileLibraryTargetGenerator
   cmMakefileTargetGenerator(target)
 {
   this->CustomCommandDriver = OnDepends;
-  if (this->Target->GetType() != cmTarget::INTERFACE_LIBRARY)
+  if (this->GeneratorTarget->GetType() != cmTarget::INTERFACE_LIBRARY)
     {
     this->GeneratorTarget->GetLibraryNames(
       this->TargetNameOut, this->TargetNameSO, this->TargetNameReal,
@@ -62,7 +62,7 @@ void cmMakefileLibraryTargetGenerator::WriteRuleFiles()
 
   // write the link rules
   // Write the rule for this target type.
-  switch(this->Target->GetType())
+  switch(this->GeneratorTarget->GetType())
     {
     case cmTarget::STATIC_LIBRARY:
       this->WriteStaticLibraryRules();
@@ -253,8 +253,8 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules
   this->LocalGenerator->AppendFlags(linkFlags, extraFlags);
 
   // Add OSX version flags, if any.
-  if(this->Target->GetType() == cmTarget::SHARED_LIBRARY ||
-     this->Target->GetType() == cmTarget::MODULE_LIBRARY)
+  if(this->GeneratorTarget->GetType() == cmTarget::SHARED_LIBRARY ||
+     this->GeneratorTarget->GetType() == cmTarget::MODULE_LIBRARY)
     {
     this->AppendOSXVerFlag(linkFlags, linkLanguage, "COMPATIBILITY", true);
     this->AppendOSXVerFlag(linkFlags, linkLanguage, "CURRENT", false);
@@ -351,7 +351,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules
     // Add the link message.
     std::string buildEcho = "Linking ";
     buildEcho += linkLanguage;
-    switch(this->Target->GetType())
+    switch(this->GeneratorTarget->GetType())
       {
       case cmTarget::STATIC_LIBRARY:
         buildEcho += " static library ";
@@ -375,7 +375,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules
     }
 
   const char* forbiddenFlagVar = 0;
-  switch(this->Target->GetType())
+  switch(this->GeneratorTarget->GetType())
     {
     case cmTarget::SHARED_LIBRARY:
       forbiddenFlagVar = "_CREATE_SHARED_LIBRARY_FORBIDDEN_FLAGS";
@@ -429,7 +429,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules
 #ifdef _WIN32
   // There may be a manifest file for this target.  Add it to the
   // clean set just in case.
-  if(this->Target->GetType() != cmTarget::STATIC_LIBRARY)
+  if(this->GeneratorTarget->GetType() != cmTarget::STATIC_LIBRARY)
     {
     libCleanFiles.push_back(
       this->Convert((targetFullPath+".manifest").c_str(),
@@ -441,7 +441,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules
   std::vector<std::string> commands1;
   // Add a command to remove any existing files for this library.
   // for static libs only
-  if(this->Target->GetType() == cmTarget::STATIC_LIBRARY)
+  if(this->GeneratorTarget->GetType() == cmTarget::STATIC_LIBRARY)
     {
     this->LocalGenerator->AppendCleanCommand(commands1, libCleanFiles,
                                              *this->Target, "target");
@@ -497,7 +497,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules
   std::vector<std::string> archiveAppendCommands;
   std::vector<std::string> archiveFinishCommands;
   std::string::size_type archiveCommandLimit = std::string::npos;
-  if(this->Target->GetType() == cmTarget::STATIC_LIBRARY)
+  if(this->GeneratorTarget->GetType() == cmTarget::STATIC_LIBRARY)
     {
     haveStaticLibraryRule =
       this->Makefile->GetDefinition(linkRuleVar)? true:false;
@@ -552,7 +552,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules
 
   // Collect up flags to link in needed libraries.
   std::string linkLibs;
-  if(this->Target->GetType() != cmTarget::STATIC_LIBRARY)
+  if(this->GeneratorTarget->GetType() != cmTarget::STATIC_LIBRARY)
     {
     this->CreateLinkLibs(linkLibs, relink, useResponseFileForLibs, depends,
                          useWatcomQuote);
@@ -566,7 +566,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules
                           useWatcomQuote);
 
   // maybe create .def file from list of objects
-  if (this->Target->GetType() == cmTarget::SHARED_LIBRARY &&
+  if (this->GeneratorTarget->GetType() == cmTarget::SHARED_LIBRARY &&
       this->Makefile->IsOn("CMAKE_SUPPORT_WINDOWS_EXPORT_ALL_SYMBOLS"))
     {
     if(this->Target->GetPropertyAsBool("WINDOWS_EXPORT_ALL_SYMBOLS"))
@@ -667,7 +667,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules
 
   // Compute the directory portion of the install_name setting.
   std::string install_name_dir;
-  if(this->Target->GetType() == cmTarget::SHARED_LIBRARY)
+  if(this->GeneratorTarget->GetType() == cmTarget::SHARED_LIBRARY)
     {
     // Get the install_name directory for the build tree.
     install_name_dir =

+ 6 - 6
Source/cmMakefileTargetGenerator.cxx

@@ -542,10 +542,10 @@ cmMakefileTargetGenerator
   std::string targetFullPathReal;
   std::string targetFullPathPDB;
   std::string targetFullPathCompilePDB;
-  if(this->Target->GetType() == cmTarget::EXECUTABLE ||
-     this->Target->GetType() == cmTarget::STATIC_LIBRARY ||
-     this->Target->GetType() == cmTarget::SHARED_LIBRARY ||
-     this->Target->GetType() == cmTarget::MODULE_LIBRARY)
+  if(this->GeneratorTarget->GetType() == cmTarget::EXECUTABLE ||
+     this->GeneratorTarget->GetType() == cmTarget::STATIC_LIBRARY ||
+     this->GeneratorTarget->GetType() == cmTarget::SHARED_LIBRARY ||
+     this->GeneratorTarget->GetType() == cmTarget::MODULE_LIBRARY)
     {
     targetFullPathReal =
       this->GeneratorTarget->GetFullPath(this->ConfigName, false, true);
@@ -554,7 +554,7 @@ cmMakefileTargetGenerator
     targetFullPathPDB += "/";
     targetFullPathPDB += this->GeneratorTarget->GetPDBName(this->ConfigName);
     }
-  if(this->Target->GetType() <= cmTarget::OBJECT_LIBRARY)
+  if(this->GeneratorTarget->GetType() <= cmTarget::OBJECT_LIBRARY)
     {
     targetFullPathCompilePDB =
       this->GeneratorTarget->GetCompilePDBPath(this->ConfigName);
@@ -1445,7 +1445,7 @@ void cmMakefileTargetGenerator
 ::AppendTargetDepends(std::vector<std::string>& depends)
 {
   // Static libraries never depend on anything for linking.
-  if(this->Target->GetType() == cmTarget::STATIC_LIBRARY)
+  if(this->GeneratorTarget->GetType() == cmTarget::STATIC_LIBRARY)
     {
     return;
     }

+ 8 - 6
Source/cmNinjaNormalTargetGenerator.cxx

@@ -87,7 +87,7 @@ void cmNinjaNormalTargetGenerator::Generate()
   // Write the build statements
   this->WriteObjectBuildStatements();
 
-  if(this->GetTarget()->GetType() == cmTarget::OBJECT_LIBRARY)
+  if(this->GetGeneratorTarget()->GetType() == cmTarget::OBJECT_LIBRARY)
     {
     this->WriteObjectLibStatement();
     }
@@ -103,7 +103,7 @@ void cmNinjaNormalTargetGenerator::WriteLanguagesRules()
   cmGlobalNinjaGenerator::WriteDivider(this->GetRulesFileStream());
   this->GetRulesFileStream()
     << "# Rules for each languages for "
-    << cmTarget::GetTargetTypeName(this->GetTarget()->GetType())
+    << cmTarget::GetTargetTypeName(this->GetGeneratorTarget()->GetType())
     << " target "
     << this->GetTargetName()
     << "\n\n";
@@ -133,7 +133,7 @@ void cmNinjaNormalTargetGenerator::WriteLanguagesRules()
 
 const char *cmNinjaNormalTargetGenerator::GetVisibleTypeName() const
 {
-  switch (this->GetTarget()->GetType()) {
+  switch (this->GetGeneratorTarget()->GetType()) {
     case cmTarget::STATIC_LIBRARY:
       return "static library";
     case cmTarget::SHARED_LIBRARY:
@@ -156,7 +156,8 @@ cmNinjaNormalTargetGenerator
 {
   return this->TargetLinkLanguage
     + "_"
-    + cmTarget::GetTargetTypeName(this->GetTarget()->GetType())
+    + cmTarget::GetTargetTypeName(
+        (cmTarget::TargetType)this->GetGeneratorTarget()->GetType())
     + "_LINKER__"
     + cmGlobalNinjaGenerator::EncodeRuleName(this->GetTarget()->GetName())
     ;
@@ -166,7 +167,8 @@ void
 cmNinjaNormalTargetGenerator
 ::WriteLinkRule(bool useResponseFile)
 {
-  cmTarget::TargetType targetType = this->GetTarget()->GetType();
+  cmTarget::TargetType targetType =
+      (cmTarget::TargetType)this->GetGeneratorTarget()->GetType();
   std::string ruleName = this->LanguageLinkerRule();
 
   // Select whether to use a response file for objects.
@@ -330,7 +332,7 @@ cmNinjaNormalTargetGenerator
     return linkCmds;
     }
   }
-  switch (this->GetTarget()->GetType()) {
+  switch (this->GetGeneratorTarget()->GetType()) {
     case cmTarget::STATIC_LIBRARY: {
       // We have archive link commands set. First, delete the existing archive.
       {

+ 9 - 8
Source/cmNinjaTargetGenerator.cxx

@@ -189,8 +189,8 @@ ComputeDefines(cmSourceFile const* source, const std::string& language)
 cmNinjaDeps cmNinjaTargetGenerator::ComputeLinkDeps() const
 {
   // Static libraries never depend on other targets for linking.
-  if (this->Target->GetType() == cmTarget::STATIC_LIBRARY ||
-      this->Target->GetType() == cmTarget::OBJECT_LIBRARY)
+  if (this->GeneratorTarget->GetType() == cmTarget::STATIC_LIBRARY ||
+      this->GeneratorTarget->GetType() == cmTarget::OBJECT_LIBRARY)
     return cmNinjaDeps();
 
   cmComputeLinkInformation* cli =
@@ -283,16 +283,16 @@ bool cmNinjaTargetGenerator::SetMsvcTargetPdbVariable(cmNinjaVars& vars) const
     {
     std::string pdbPath;
     std::string compilePdbPath;
-    if(this->Target->GetType() == cmTarget::EXECUTABLE ||
-       this->Target->GetType() == cmTarget::STATIC_LIBRARY ||
-       this->Target->GetType() == cmTarget::SHARED_LIBRARY ||
-       this->Target->GetType() == cmTarget::MODULE_LIBRARY)
+    if(this->GeneratorTarget->GetType() == cmTarget::EXECUTABLE ||
+       this->GeneratorTarget->GetType() == cmTarget::STATIC_LIBRARY ||
+       this->GeneratorTarget->GetType() == cmTarget::SHARED_LIBRARY ||
+       this->GeneratorTarget->GetType() == cmTarget::MODULE_LIBRARY)
       {
       pdbPath = this->GeneratorTarget->GetPDBDirectory(this->GetConfigName());
       pdbPath += "/";
       pdbPath += this->GeneratorTarget->GetPDBName(this->GetConfigName());
       }
-    if(this->Target->GetType() <= cmTarget::OBJECT_LIBRARY)
+    if(this->GeneratorTarget->GetType() <= cmTarget::OBJECT_LIBRARY)
       {
       compilePdbPath =
               this->GeneratorTarget->GetCompilePDBPath(this->GetConfigName());
@@ -480,7 +480,8 @@ cmNinjaTargetGenerator
   cmGlobalNinjaGenerator::WriteDivider(this->GetBuildFileStream());
   this->GetBuildFileStream()
     << "# Object build statements for "
-    << cmTarget::GetTargetTypeName(this->GetTarget()->GetType())
+    << cmTarget::GetTargetTypeName(
+         (cmTarget::TargetType)this->GetGeneratorTarget()->GetType())
     << " target "
     << this->GetTargetName()
     << "\n\n";

+ 41 - 38
Source/cmVisualStudio10TargetGenerator.cxx

@@ -269,7 +269,7 @@ void cmVisualStudio10TargetGenerator::WriteString(const char* line,
 void cmVisualStudio10TargetGenerator::Generate()
 {
   // do not generate external ms projects
-  if(this->Target->GetType() == cmTarget::INTERFACE_LIBRARY
+  if(this->GeneratorTarget->GetType() == cmTarget::INTERFACE_LIBRARY
       || this->Target->GetProperty("EXTERNAL_MSPROJECT"))
     {
     return;
@@ -278,7 +278,7 @@ void cmVisualStudio10TargetGenerator::Generate()
   this->Target->SetProperty("GENERATOR_FILE_NAME",this->Name.c_str());
   this->Target->SetProperty("GENERATOR_FILE_NAME_EXT",
                             ".vcxproj");
-  if(this->Target->GetType() <= cmTarget::OBJECT_LIBRARY)
+  if(this->GeneratorTarget->GetType() <= cmTarget::OBJECT_LIBRARY)
     {
     if(!this->ComputeClOptions())
       {
@@ -360,7 +360,8 @@ void cmVisualStudio10TargetGenerator::Generate()
   this->WriteString("<ProjectGUID>", 2);
   (*this->BuildFileStream) <<  "{" << this->GUID << "}</ProjectGUID>\n";
 
-  if(this->MSTools && this->Target->GetType() <= cmTarget::GLOBAL_TARGET)
+  if(this->MSTools
+     && this->GeneratorTarget->GetType() <= cmTarget::GLOBAL_TARGET)
     {
     this->WriteApplicationTypeSettings();
     this->VerifyNecessaryFiles();
@@ -666,7 +667,7 @@ void cmVisualStudio10TargetGenerator::WriteProjectConfigurationValues()
                                  i->c_str(),
                                  1, " Label=\"Configuration\"", "\n");
     std::string configType = "<ConfigurationType>";
-    switch(this->Target->GetType())
+    switch(this->GeneratorTarget->GetType())
       {
       case cmTarget::SHARED_LIBRARY:
       case cmTarget::MODULE_LIBRARY:
@@ -743,7 +744,7 @@ void cmVisualStudio10TargetGenerator
   mfcLine += useOfMfcValue + "</UseOfMfc>\n";
   this->WriteString(mfcLine.c_str(), 2);
 
-  if((this->Target->GetType() <= cmTarget::OBJECT_LIBRARY &&
+  if((this->GeneratorTarget->GetType() <= cmTarget::OBJECT_LIBRARY &&
       this->ClOptions[config]->UsingUnicode()) ||
      this->Target->GetPropertyAsBool("VS_WINRT_COMPONENT") ||
      this->GlobalGenerator->TargetsWindowsPhone() ||
@@ -752,7 +753,7 @@ void cmVisualStudio10TargetGenerator
     {
     this->WriteString("<CharacterSet>Unicode</CharacterSet>\n", 2);
     }
-  else if (this->Target->GetType() <= cmTarget::MODULE_LIBRARY &&
+  else if (this->GeneratorTarget->GetType() <= cmTarget::MODULE_LIBRARY &&
            this->ClOptions[config]->UsingSBCS())
     {
     this->WriteString("<CharacterSet>NotSet</CharacterSet>\n", 2);
@@ -1480,7 +1481,7 @@ void cmVisualStudio10TargetGenerator::WriteSources(
 
 void cmVisualStudio10TargetGenerator::WriteAllSources()
 {
-  if(this->Target->GetType() > cmTarget::UTILITY)
+  if(this->GeneratorTarget->GetType() > cmTarget::UTILITY)
     {
     return;
     }
@@ -1742,7 +1743,8 @@ bool cmVisualStudio10TargetGenerator::OutputSourceSpecificFlags(
 
 void cmVisualStudio10TargetGenerator::WritePathAndIncrementalLinkOptions()
 {
-  cmTarget::TargetType ttype = this->Target->GetType();
+  cmTarget::TargetType ttype =
+      (cmTarget::TargetType)this->GeneratorTarget->GetType();
   if(ttype > cmTarget::GLOBAL_TARGET)
     {
     return;
@@ -1827,8 +1829,8 @@ OutputLinkIncremental(std::string const& configName)
     }
   // static libraries and things greater than modules do not need
   // to set this option
-  if(this->Target->GetType() == cmTarget::STATIC_LIBRARY
-     || this->Target->GetType() > cmTarget::MODULE_LIBRARY)
+  if(this->GeneratorTarget->GetType() == cmTarget::STATIC_LIBRARY
+     || this->GeneratorTarget->GetType() > cmTarget::MODULE_LIBRARY)
     {
     return;
     }
@@ -1966,8 +1968,8 @@ bool cmVisualStudio10TargetGenerator::ComputeClOptions(
       {
       clOptions.AddFlag("CompileAsWinRT", "true");
       // For WinRT components, add the _WINRT_DLL define to produce a lib
-      if (this->Target->GetType() == cmTarget::SHARED_LIBRARY ||
-          this->Target->GetType() == cmTarget::MODULE_LIBRARY )
+      if (this->GeneratorTarget->GetType() == cmTarget::SHARED_LIBRARY ||
+          this->GeneratorTarget->GetType() == cmTarget::MODULE_LIBRARY )
         {
         clOptions.AddDefine("_WINRT_DLL");
         }
@@ -2175,8 +2177,8 @@ WriteMasmOptions(std::string const& configName,
 void
 cmVisualStudio10TargetGenerator::WriteLibOptions(std::string const& config)
 {
-  if(this->Target->GetType() != cmTarget::STATIC_LIBRARY &&
-     this->Target->GetType() != cmTarget::OBJECT_LIBRARY)
+  if(this->GeneratorTarget->GetType() != cmTarget::STATIC_LIBRARY &&
+     this->GeneratorTarget->GetType() != cmTarget::OBJECT_LIBRARY)
     {
     return;
     }
@@ -2212,9 +2214,9 @@ cmVisualStudio10TargetGenerator::WriteLibOptions(std::string const& config)
 void cmVisualStudio10TargetGenerator::WriteManifestOptions(
   std::string const& config)
 {
-  if (this->Target->GetType() != cmTarget::EXECUTABLE &&
-      this->Target->GetType() != cmTarget::SHARED_LIBRARY &&
-      this->Target->GetType() != cmTarget::MODULE_LIBRARY)
+  if (this->GeneratorTarget->GetType() != cmTarget::EXECUTABLE &&
+      this->GeneratorTarget->GetType() != cmTarget::SHARED_LIBRARY &&
+      this->GeneratorTarget->GetType() != cmTarget::MODULE_LIBRARY)
     {
     return;
     }
@@ -2380,9 +2382,9 @@ void cmVisualStudio10TargetGenerator::WriteAntBuildOptions(
 //----------------------------------------------------------------------------
 bool cmVisualStudio10TargetGenerator::ComputeLinkOptions()
 {
-  if(this->Target->GetType() == cmTarget::EXECUTABLE ||
-     this->Target->GetType() == cmTarget::SHARED_LIBRARY ||
-     this->Target->GetType() == cmTarget::MODULE_LIBRARY)
+  if(this->GeneratorTarget->GetType() == cmTarget::EXECUTABLE ||
+     this->GeneratorTarget->GetType() == cmTarget::SHARED_LIBRARY ||
+     this->GeneratorTarget->GetType() == cmTarget::MODULE_LIBRARY)
     {
     for(std::vector<std::string>::const_iterator
           i = this->Configurations.begin();
@@ -2419,11 +2421,11 @@ cmVisualStudio10TargetGenerator::ComputeLinkOptions(std::string const& config)
   std::string CONFIG = cmSystemTools::UpperCase(config);
 
   const char* linkType = "SHARED";
-  if(this->Target->GetType() == cmTarget::MODULE_LIBRARY)
+  if(this->GeneratorTarget->GetType() == cmTarget::MODULE_LIBRARY)
     {
     linkType = "MODULE";
     }
-  if(this->Target->GetType() == cmTarget::EXECUTABLE)
+  if(this->GeneratorTarget->GetType() == cmTarget::EXECUTABLE)
     {
     linkType = "EXE";
     }
@@ -2506,7 +2508,7 @@ cmVisualStudio10TargetGenerator::ComputeLinkOptions(std::string const& config)
   std::string targetNameFull;
   std::string targetNameImport;
   std::string targetNamePDB;
-  if(this->Target->GetType() == cmTarget::EXECUTABLE)
+  if(this->GeneratorTarget->GetType() == cmTarget::EXECUTABLE)
     {
     this->GeneratorTarget->GetExecutableNames(targetName, targetNameFull,
                                      targetNameImport, targetNamePDB,
@@ -2529,7 +2531,7 @@ cmVisualStudio10TargetGenerator::ComputeLinkOptions(std::string const& config)
       if (this->GlobalGenerator->TargetsWindowsCE())
         {
         linkOptions.AddFlag("SubSystem", "WindowsCE");
-        if (this->Target->GetType() == cmTarget::EXECUTABLE)
+        if (this->GeneratorTarget->GetType() == cmTarget::EXECUTABLE)
           {
           if (this->ClOptions[config]->UsingUnicode())
             {
@@ -2551,7 +2553,7 @@ cmVisualStudio10TargetGenerator::ComputeLinkOptions(std::string const& config)
       if (this->GlobalGenerator->TargetsWindowsCE())
         {
         linkOptions.AddFlag("SubSystem", "WindowsCE");
-        if (this->Target->GetType() == cmTarget::EXECUTABLE)
+        if (this->GeneratorTarget->GetType() == cmTarget::EXECUTABLE)
           {
           if (this->ClOptions[config]->UsingUnicode())
             {
@@ -2597,7 +2599,7 @@ cmVisualStudio10TargetGenerator::ComputeLinkOptions(std::string const& config)
     // A Windows Runtime component uses internal .NET metadata,
     // so does not have an import library.
     if(this->Target->GetPropertyAsBool("VS_WINRT_COMPONENT") &&
-       this->Target->GetType() != cmTarget::EXECUTABLE)
+       this->GeneratorTarget->GetType() != cmTarget::EXECUTABLE)
       {
       linkOptions.AddFlag("GenerateWindowsMetadata", "true");
       }
@@ -2635,7 +2637,7 @@ cmVisualStudio10TargetGenerator::ComputeLinkOptions(std::string const& config)
                            "%(IgnoreSpecificDefaultLibraries)");
     }
 
-  if (this->Target->GetType() == cmTarget::SHARED_LIBRARY &&
+  if (this->GeneratorTarget->GetType() == cmTarget::SHARED_LIBRARY &&
       this->Makefile->IsOn("CMAKE_SUPPORT_WINDOWS_EXPORT_ALL_SYMBOLS"))
     {
     if (this->Target->GetPropertyAsBool("WINDOWS_EXPORT_ALL_SYMBOLS"))
@@ -2652,8 +2654,8 @@ cmVisualStudio10TargetGenerator::ComputeLinkOptions(std::string const& config)
 void
 cmVisualStudio10TargetGenerator::WriteLinkOptions(std::string const& config)
 {
-  if(this->Target->GetType() == cmTarget::STATIC_LIBRARY
-     || this->Target->GetType() > cmTarget::MODULE_LIBRARY)
+  if(this->GeneratorTarget->GetType() == cmTarget::STATIC_LIBRARY
+     || this->GeneratorTarget->GetType() > cmTarget::MODULE_LIBRARY)
     {
     return;
     }
@@ -2763,7 +2765,7 @@ void cmVisualStudio10TargetGenerator::WriteItemDefinitionGroups()
     this->WritePlatformConfigTag("ItemDefinitionGroup", i->c_str(), 1);
     *this->BuildFileStream << "\n";
     //    output cl compile flags <ClCompile></ClCompile>
-    if(this->Target->GetType() <= cmTarget::OBJECT_LIBRARY)
+    if(this->GeneratorTarget->GetType() <= cmTarget::OBJECT_LIBRARY)
       {
       this->WriteClOptions(*i, includes);
       //    output rc compile flags <ResourceCompile></ResourceCompile>
@@ -2781,7 +2783,7 @@ void cmVisualStudio10TargetGenerator::WriteItemDefinitionGroups()
     //    output manifest flags  <Manifest></Manifest>
     this->WriteManifestOptions(*i);
     if(this->NsightTegra &&
-       this->Target->GetType() == cmTarget::EXECUTABLE &&
+       this->GeneratorTarget->GetType() == cmTarget::EXECUTABLE &&
        this->Target->GetPropertyAsBool("ANDROID_GUI"))
       {
       this->WriteAntBuildOptions(*i);
@@ -2794,7 +2796,7 @@ void
 cmVisualStudio10TargetGenerator::WriteEvents(std::string const& configName)
 {
   bool addedPrelink = false;
-  if (this->Target->GetType() == cmTarget::SHARED_LIBRARY &&
+  if (this->GeneratorTarget->GetType() == cmTarget::SHARED_LIBRARY &&
       this->Makefile->IsOn("CMAKE_SUPPORT_WINDOWS_EXPORT_ALL_SYMBOLS"))
     {
     if (this->Target->GetPropertyAsBool("WINDOWS_EXPORT_ALL_SYMBOLS"))
@@ -3002,7 +3004,7 @@ void cmVisualStudio10TargetGenerator::WriteWinRTPackageCertificateKeyFile()
 {
   if((this->GlobalGenerator->TargetsWindowsStore() ||
       this->GlobalGenerator->TargetsWindowsPhone())
-      && (cmTarget::EXECUTABLE == this->Target->GetType()))
+      && (cmTarget::EXECUTABLE == this->GeneratorTarget->GetType()))
     {
     std::string pfxFile;
     std::vector<cmSourceFile const*> certificates;
@@ -3131,7 +3133,7 @@ void cmVisualStudio10TargetGenerator::WriteApplicationTypeSettings()
       this->WriteString("<MinimumVisualStudioVersion>14.0"
         "</MinimumVisualStudioVersion>\n", 2);
 
-      if(this->Target->GetType() < cmTarget::UTILITY)
+      if(this->GeneratorTarget->GetType() < cmTarget::UTILITY)
         {
         isAppContainer = true;
         }
@@ -3145,7 +3147,7 @@ void cmVisualStudio10TargetGenerator::WriteApplicationTypeSettings()
       this->WriteString("<MinimumVisualStudioVersion>12.0"
                         "</MinimumVisualStudioVersion>\n", 2);
 
-      if (this->Target->GetType() < cmTarget::UTILITY)
+      if (this->GeneratorTarget->GetType() < cmTarget::UTILITY)
         {
         isAppContainer = true;
         }
@@ -3159,12 +3161,13 @@ void cmVisualStudio10TargetGenerator::WriteApplicationTypeSettings()
       this->WriteString("<MinimumVisualStudioVersion>11.0"
                         "</MinimumVisualStudioVersion>\n", 2);
 
-      if (isWindowsStore && this->Target->GetType() < cmTarget::UTILITY)
+      if (isWindowsStore
+          && this->GeneratorTarget->GetType() < cmTarget::UTILITY)
         {
         isAppContainer = true;
         }
       else if (isWindowsPhone &&
-               this->Target->GetType() == cmTarget::EXECUTABLE)
+               this->GeneratorTarget->GetType() == cmTarget::EXECUTABLE)
         {
         this->WriteString("<XapOutputs>true</XapOutputs>\n", 2);
         this->WriteString("<XapFilename>", 2);
@@ -3221,7 +3224,7 @@ void cmVisualStudio10TargetGenerator::VerifyNecessaryFiles()
 {
   // For Windows and Windows Phone executables, we will assume that if a
   // manifest is not present that we need to add all the necessary files
-  if (this->Target->GetType() == cmTarget::EXECUTABLE)
+  if (this->GeneratorTarget->GetType() == cmTarget::EXECUTABLE)
     {
     std::vector<cmSourceFile const*> manifestSources;
     this->GeneratorTarget->GetAppManifest(manifestSources, "");