Generators: Use GetType from the cmGeneratorTarget.

This commit is contained in:
Stephen Kelly 2015-10-14 23:14:43 +02:00
parent 088fcbf733
commit 983c00f8f9
14 changed files with 100 additions and 93 deletions

View File

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

View File

@ -554,7 +554,8 @@ cmComputeTargetDepends
// Describe the depender. // Describe the depender.
e << " \"" << depender->GetName() << "\" of type " 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. // List its dependencies that are inside the component.
EdgeList const& nl = this->InitialGraph[i]; EdgeList const& nl = this->InitialGraph[i];

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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