Merge topic 'use-generator-target'

d8f8940b cmGeneratorTarget: Move IsCFBundleOnApple from cmTarget.
7550879f cmGeneratorTarget: Move IsXCTestOnApple from cmTarget.
88d10d55 cmGeneratorTarget: Copy IsAppBundleOnApple from cmTarget.
b5f5de70 cmGeneratorTarget: Copy IsFrameworkOnApple from cmTarget.
8e20ea6e cmGeneratorTarget: Move IsLinkable from cmTarget.
a527abf0 Xcode: Port internal API to cmGeneratorTarget.
eb3be7d6 cmGeneratorTarget: Move GetExportName from cmTarget.
d231c31b Export: Port internal API to cmGeneratorTarget.
e6661282 Export: Port internal utility to cmGeneratorTarget.
2b9cc1e2 Export: Port some API to cmGlobalGenerator.
97062ac2 cmInstallTargetGenerator: Port GetInstallFilename to cmGeneratorTarget.
6a72b3c8 Export: Port interface to cmGeneratorTarget.
1293c156 cmExportTryCompileFileGenerator: Port to cmGeneratorTarget.
381e7afd cmExportSet: Store a cmGeneratorTarget.
65911cae cmGlobalGenerator: Compute export() related classes early.
37ab74a6 cmLocalGenerator: Port PList handling to cmGeneratorTarget.
...
This commit is contained in:
Brad King 2015-10-20 11:16:45 -04:00 committed by CMake Topic Stage
commit 9afbb733ec
53 changed files with 1233 additions and 1075 deletions

View File

@ -109,7 +109,7 @@ std::string cmCommonTargetGenerator::ComputeFortranModuleDirectory() const
{ {
std::string mod_dir; std::string mod_dir;
const char* target_mod_dir = const char* target_mod_dir =
this->Target->GetProperty("Fortran_MODULE_DIRECTORY"); this->GeneratorTarget->GetProperty("Fortran_MODULE_DIRECTORY");
const char* moddir_flag = const char* moddir_flag =
this->Makefile->GetDefinition("CMAKE_Fortran_MODDIR_FLAG"); this->Makefile->GetDefinition("CMAKE_Fortran_MODDIR_FLAG");
if(target_mod_dir && moddir_flag) if(target_mod_dir && moddir_flag)
@ -214,7 +214,7 @@ cmCommonTargetGenerator
this->LocalGenerator->GetFortranFormat(srcfmt); this->LocalGenerator->GetFortranFormat(srcfmt);
if(format == cmLocalGenerator::FortranFormatNone) if(format == cmLocalGenerator::FortranFormatNone)
{ {
const char* tgtfmt = this->Target->GetProperty("Fortran_FORMAT"); const char* tgtfmt = this->GeneratorTarget->GetProperty("Fortran_FORMAT");
format = this->LocalGenerator->GetFortranFormat(tgtfmt); format = this->LocalGenerator->GetFortranFormat(tgtfmt);
} }
const char* var = 0; const char* var = 0;
@ -316,10 +316,11 @@ std::string cmCommonTargetGenerator::GetFlags(const std::string &l)
this->AddFortranFlags(flags); this->AddFortranFlags(flags);
} }
this->LocalGenerator->AddCMP0018Flags(flags, this->Target, this->LocalGenerator->AddCMP0018Flags(flags, this->GeneratorTarget,
lang, this->ConfigName); lang, this->ConfigName);
this->LocalGenerator->AddVisibilityPresetFlags(flags, this->Target, this->LocalGenerator->AddVisibilityPresetFlags(flags,
this->GeneratorTarget,
lang); lang);
// Append old-style preprocessor definition flags. // Append old-style preprocessor definition flags.
@ -331,7 +332,7 @@ std::string cmCommonTargetGenerator::GetFlags(const std::string &l)
AppendFlags(flags,this->GetFrameworkFlags(l)); AppendFlags(flags,this->GetFrameworkFlags(l));
// Add target-specific flags. // Add target-specific flags.
this->LocalGenerator->AddCompileOptions(flags, this->Target, this->LocalGenerator->AddCompileOptions(flags, this->GeneratorTarget,
lang, this->ConfigName); lang, this->ConfigName);
ByLanguageMap::value_type entry(l, flags); ByLanguageMap::value_type entry(l, flags);
@ -354,7 +355,7 @@ std::string cmCommonTargetGenerator::GetDefines(const std::string &l)
} }
// Add preprocessor definitions for this target and configuration. // Add preprocessor definitions for this target and configuration.
this->LocalGenerator->AddCompileDefinitions(defines, this->Target, this->LocalGenerator->AddCompileDefinitions(defines, this->GeneratorTarget,
this->LocalGenerator->GetConfigName(), l); this->LocalGenerator->GetConfigName(), l);
std::string definesString; std::string definesString;
@ -400,8 +401,7 @@ cmCommonTargetGenerator::GetLinkedTargetDirectories() const
&& emitted.insert(linkee).second) && emitted.insert(linkee).second)
{ {
cmLocalGenerator* lg = linkee->GetLocalGenerator(); cmLocalGenerator* lg = linkee->GetLocalGenerator();
cmMakefile* mf = linkee->Target->GetMakefile(); std::string di = lg->GetCurrentBinaryDirectory();
std::string di = mf->GetCurrentBinaryDirectory();
di += "/"; di += "/";
di += lg->GetTargetDirectory(linkee); di += lg->GetTargetDirectory(linkee);
dirs.push_back(di); dirs.push_back(di);

View File

@ -643,7 +643,7 @@ void cmComputeLinkInformation::AddItem(std::string const& item,
return; return;
} }
if(tgt && tgt->Target->IsLinkable()) if(tgt && tgt->IsLinkable())
{ {
// This is a CMake target. Ask the target for its real name. // This is a CMake target. Ask the target for its real name.
if(impexe && this->LoaderFlag) if(impexe && this->LoaderFlag)
@ -1111,7 +1111,7 @@ void cmComputeLinkInformation::AddTargetItem(std::string const& item,
// For compatibility with CMake 2.4 include the item's directory in // For compatibility with CMake 2.4 include the item's directory in
// the linker search path. // the linker search path.
if(this->OldLinkDirMode && !target->Target->IsFrameworkOnApple() && if(this->OldLinkDirMode && !target->IsFrameworkOnApple() &&
this->OldLinkDirMask.find(cmSystemTools::GetFilenamePath(item)) == this->OldLinkDirMask.find(cmSystemTools::GetFilenamePath(item)) ==
this->OldLinkDirMask.end()) this->OldLinkDirMask.end())
{ {

View File

@ -417,7 +417,7 @@ void cmComputeTargetDepends::AddTargetDepend(int depender_index,
const cmGeneratorTarget* dependee, const cmGeneratorTarget* dependee,
bool linking) bool linking)
{ {
if(dependee->Target->IsImported() || if(dependee->IsImported() ||
dependee->GetType() == cmState::INTERFACE_LIBRARY) dependee->GetType() == cmState::INTERFACE_LIBRARY)
{ {
// Skip IMPORTED and INTERFACE targets but follow their utility // Skip IMPORTED and INTERFACE targets but follow their utility

View File

@ -34,7 +34,7 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv)
std::string outputVariable; std::string outputVariable;
std::string copyFile; std::string copyFile;
std::string copyFileError; std::string copyFileError;
std::vector<cmTarget const*> targets; std::vector<std::string> targets;
std::string libsToLink = " "; std::string libsToLink = " ";
bool useOldLinkLibs = true; bool useOldLinkLibs = true;
char targetNameBuf[64]; char targetNameBuf[64];
@ -112,7 +112,7 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv)
} }
if (tgt->IsImported()) if (tgt->IsImported())
{ {
targets.push_back(tgt); targets.push_back(argv[i]);
} }
} }
} }
@ -375,9 +375,8 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv)
if (!targets.empty()) if (!targets.empty())
{ {
std::string fname = "/" + std::string(targetName) + "Targets.cmake"; std::string fname = "/" + std::string(targetName) + "Targets.cmake";
cmExportTryCompileFileGenerator tcfg(gg); cmExportTryCompileFileGenerator tcfg(gg, targets, this->Makefile);
tcfg.SetExportFile((this->BinaryDirectory + fname).c_str()); tcfg.SetExportFile((this->BinaryDirectory + fname).c_str());
tcfg.SetExports(targets);
tcfg.SetConfig(this->Makefile->GetSafeDefinition( tcfg.SetConfig(this->Makefile->GetSafeDefinition(
"CMAKE_TRY_COMPILE_CONFIGURATION")); "CMAKE_TRY_COMPILE_CONFIGURATION"));

View File

@ -45,7 +45,7 @@ std::string cmCustomCommandGenerator::GetCommand(unsigned int c) const
cmGeneratorTarget* target = cmGeneratorTarget* target =
this->LG->FindGeneratorTargetToUse(argv0); this->LG->FindGeneratorTargetToUse(argv0);
if(target && target->GetType() == cmState::EXECUTABLE && if(target && target->GetType() == cmState::EXECUTABLE &&
(target->Target->IsImported() (target->IsImported()
|| !this->LG->GetMakefile()->IsOn("CMAKE_CROSSCOMPILING"))) || !this->LG->GetMakefile()->IsOn("CMAKE_CROSSCOMPILING")))
{ {
return target->GetLocation(this->Config); return target->GetLocation(this->Config);

View File

@ -27,6 +27,10 @@ cmExportBuildFileGenerator::cmExportBuildFileGenerator()
void cmExportBuildFileGenerator::Compute(cmLocalGenerator* lg) void cmExportBuildFileGenerator::Compute(cmLocalGenerator* lg)
{ {
this->LG = lg; this->LG = lg;
if (this->ExportSet)
{
this->ExportSet->Compute(lg);
}
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
@ -44,9 +48,9 @@ bool cmExportBuildFileGenerator::GenerateMainFile(std::ostream& os)
{ {
cmGeneratorTarget *te = this->LG cmGeneratorTarget *te = this->LG
->FindGeneratorTargetToUse(*tei); ->FindGeneratorTargetToUse(*tei);
expectedTargets += sep + this->Namespace + te->Target->GetExportName(); expectedTargets += sep + this->Namespace + te->GetExportName();
sep = " "; sep = " ";
if(this->ExportedTargets.insert(te->Target).second) if(this->ExportedTargets.insert(te).second)
{ {
this->Exports.push_back(te); this->Exports.push_back(te);
} }
@ -76,45 +80,44 @@ bool cmExportBuildFileGenerator::GenerateMainFile(std::ostream& os)
tei != this->Exports.end(); ++tei) tei != this->Exports.end(); ++tei)
{ {
cmGeneratorTarget* gte = *tei; cmGeneratorTarget* gte = *tei;
cmTarget* te = gte->Target; this->GenerateImportTargetCode(os, gte);
this->GenerateImportTargetCode(os, te);
te->AppendBuildInterfaceIncludes(); gte->Target->AppendBuildInterfaceIncludes();
ImportPropertyMap properties; ImportPropertyMap properties;
this->PopulateInterfaceProperty("INTERFACE_INCLUDE_DIRECTORIES", te, this->PopulateInterfaceProperty("INTERFACE_INCLUDE_DIRECTORIES", gte,
cmGeneratorExpression::BuildInterface, cmGeneratorExpression::BuildInterface,
properties, missingTargets); properties, missingTargets);
this->PopulateInterfaceProperty("INTERFACE_SOURCES", te, this->PopulateInterfaceProperty("INTERFACE_SOURCES", gte,
cmGeneratorExpression::BuildInterface, cmGeneratorExpression::BuildInterface,
properties, missingTargets); properties, missingTargets);
this->PopulateInterfaceProperty("INTERFACE_COMPILE_DEFINITIONS", te, this->PopulateInterfaceProperty("INTERFACE_COMPILE_DEFINITIONS", gte,
cmGeneratorExpression::BuildInterface, cmGeneratorExpression::BuildInterface,
properties, missingTargets); properties, missingTargets);
this->PopulateInterfaceProperty("INTERFACE_COMPILE_OPTIONS", te, this->PopulateInterfaceProperty("INTERFACE_COMPILE_OPTIONS", gte,
cmGeneratorExpression::BuildInterface, cmGeneratorExpression::BuildInterface,
properties, missingTargets); properties, missingTargets);
this->PopulateInterfaceProperty("INTERFACE_AUTOUIC_OPTIONS", te, this->PopulateInterfaceProperty("INTERFACE_AUTOUIC_OPTIONS", gte,
cmGeneratorExpression::BuildInterface, cmGeneratorExpression::BuildInterface,
properties, missingTargets); properties, missingTargets);
this->PopulateInterfaceProperty("INTERFACE_COMPILE_FEATURES", te, this->PopulateInterfaceProperty("INTERFACE_COMPILE_FEATURES", gte,
cmGeneratorExpression::BuildInterface, cmGeneratorExpression::BuildInterface,
properties, missingTargets); properties, missingTargets);
this->PopulateInterfaceProperty("INTERFACE_POSITION_INDEPENDENT_CODE", this->PopulateInterfaceProperty("INTERFACE_POSITION_INDEPENDENT_CODE",
te, properties); gte, properties);
const bool newCMP0022Behavior = const bool newCMP0022Behavior =
te->GetPolicyStatusCMP0022() != cmPolicies::WARN gte->Target->GetPolicyStatusCMP0022() != cmPolicies::WARN
&& te->GetPolicyStatusCMP0022() != cmPolicies::OLD; && gte->Target->GetPolicyStatusCMP0022() != cmPolicies::OLD;
if (newCMP0022Behavior) if (newCMP0022Behavior)
{ {
this->PopulateInterfaceLinkLibrariesProperty(te, this->PopulateInterfaceLinkLibrariesProperty(gte,
cmGeneratorExpression::BuildInterface, cmGeneratorExpression::BuildInterface,
properties, missingTargets); properties, missingTargets);
} }
this->PopulateCompatibleInterfaceProperties(gte, properties); this->PopulateCompatibleInterfaceProperties(gte, properties);
this->GenerateInterfaceProperties(te, os, properties); this->GenerateInterfaceProperties(gte, os, properties);
} }
// Generate import file content for each configuration. // Generate import file content for each configuration.
@ -171,7 +174,7 @@ cmExportBuildFileGenerator
// properties); // properties);
// Generate code in the export file. // Generate code in the export file.
this->GenerateImportPropertyCode(os, config, target->Target, this->GenerateImportPropertyCode(os, config, target,
properties); properties);
} }
} }
@ -199,7 +202,7 @@ cmExportBuildFileGenerator
std::string prop = "IMPORTED_LOCATION"; std::string prop = "IMPORTED_LOCATION";
prop += suffix; prop += suffix;
std::string value; std::string value;
if(target->Target->IsAppBundleOnApple()) if(target->IsAppBundleOnApple())
{ {
value = target->GetFullPath(config, false); value = target->GetFullPath(config, false);
} }
@ -232,14 +235,18 @@ cmExportBuildFileGenerator
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void void
cmExportBuildFileGenerator::HandleMissingTarget( cmExportBuildFileGenerator::HandleMissingTarget(
std::string& link_libs, std::vector<std::string>& missingTargets, std::string& link_libs,
cmMakefile* mf, cmTarget* depender, cmTarget* dependee) std::vector<std::string>& missingTargets,
cmGeneratorTarget* depender,
cmGeneratorTarget* dependee)
{ {
// The target is not in the export. // The target is not in the export.
if(!this->AppendMode) if(!this->AppendMode)
{ {
const std::string name = dependee->GetName(); const std::string name = dependee->GetName();
std::vector<std::string> namespaces = this->FindNamespaces(mf, name); cmGlobalGenerator* gg =
dependee->GetLocalGenerator()->GetGlobalGenerator();
std::vector<std::string> namespaces = this->FindNamespaces(gg, name);
int targetOccurrences = (int)namespaces.size(); int targetOccurrences = (int)namespaces.size();
if (targetOccurrences == 1) if (targetOccurrences == 1)
@ -274,7 +281,7 @@ void cmExportBuildFileGenerator
tei = this->ExportSet->GetTargetExports()->begin(); tei = this->ExportSet->GetTargetExports()->begin();
tei != this->ExportSet->GetTargetExports()->end(); ++tei) tei != this->ExportSet->GetTargetExports()->end(); ++tei)
{ {
targets.push_back((*tei)->Target->GetName()); targets.push_back((*tei)->TargetName);
} }
return; return;
} }
@ -284,10 +291,9 @@ void cmExportBuildFileGenerator
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
std::vector<std::string> std::vector<std::string>
cmExportBuildFileGenerator cmExportBuildFileGenerator
::FindNamespaces(cmMakefile* mf, const std::string& name) ::FindNamespaces(cmGlobalGenerator* gg, const std::string& name)
{ {
std::vector<std::string> namespaces; std::vector<std::string> namespaces;
cmGlobalGenerator* gg = mf->GetGlobalGenerator();
std::map<std::string, cmExportBuildFileGenerator*>& exportSets std::map<std::string, cmExportBuildFileGenerator*>& exportSets
= gg->GetBuildExportSets(); = gg->GetBuildExportSets();
@ -310,8 +316,8 @@ cmExportBuildFileGenerator
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void void
cmExportBuildFileGenerator cmExportBuildFileGenerator
::ComplainAboutMissingTarget(cmTarget* depender, ::ComplainAboutMissingTarget(cmGeneratorTarget* depender,
cmTarget* dependee, cmGeneratorTarget* dependee,
int occurrences) int occurrences)
{ {
if(cmSystemTools::GetErrorOccuredFlag()) if(cmSystemTools::GetErrorOccuredFlag())

View File

@ -54,12 +54,11 @@ protected:
std::vector<std::string> &missingTargets); std::vector<std::string> &missingTargets);
virtual void HandleMissingTarget(std::string& link_libs, virtual void HandleMissingTarget(std::string& link_libs,
std::vector<std::string>& missingTargets, std::vector<std::string>& missingTargets,
cmMakefile* mf, cmGeneratorTarget* depender,
cmTarget* depender, cmGeneratorTarget* dependee);
cmTarget* dependee);
void ComplainAboutMissingTarget(cmTarget* depender, void ComplainAboutMissingTarget(cmGeneratorTarget* depender,
cmTarget* dependee, cmGeneratorTarget* dependee,
int occurrences); int occurrences);
/** Fill in properties indicating built file locations. */ /** Fill in properties indicating built file locations. */
@ -72,7 +71,7 @@ protected:
const std::string& config); const std::string& config);
std::vector<std::string> std::vector<std::string>
FindNamespaces(cmMakefile* mf, const std::string& name); FindNamespaces(cmGlobalGenerator* gg, const std::string& name);
std::vector<std::string> Targets; std::vector<std::string> Targets;
cmExportSet *ExportSet; cmExportSet *ExportSet;

View File

@ -18,7 +18,6 @@
#include "cmLocalGenerator.h" #include "cmLocalGenerator.h"
#include "cmMakefile.h" #include "cmMakefile.h"
#include "cmSystemTools.h" #include "cmSystemTools.h"
#include "cmTarget.h"
#include "cmTargetExport.h" #include "cmTargetExport.h"
#include "cmVersion.h" #include "cmVersion.h"
#include "cmComputeLinkInformation.h" #include "cmComputeLinkInformation.h"
@ -155,7 +154,7 @@ void cmExportFileGenerator::GenerateImportConfig(std::ostream& os,
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void cmExportFileGenerator::PopulateInterfaceProperty( void cmExportFileGenerator::PopulateInterfaceProperty(
const std::string& propName, const std::string& propName,
cmTarget *target, cmGeneratorTarget *target,
ImportPropertyMap &properties) ImportPropertyMap &properties)
{ {
const char *input = target->GetProperty(propName); const char *input = target->GetProperty(propName);
@ -169,7 +168,7 @@ void cmExportFileGenerator::PopulateInterfaceProperty(
void cmExportFileGenerator::PopulateInterfaceProperty( void cmExportFileGenerator::PopulateInterfaceProperty(
const std::string& propName, const std::string& propName,
const std::string& outputName, const std::string& outputName,
cmTarget *target, cmGeneratorTarget *target,
cmGeneratorExpression::PreprocessContext preprocessRule, cmGeneratorExpression::PreprocessContext preprocessRule,
ImportPropertyMap &properties, ImportPropertyMap &properties,
std::vector<std::string> &missingTargets) std::vector<std::string> &missingTargets)
@ -206,7 +205,7 @@ void cmExportFileGenerator::GenerateRequiredCMakeVersion(std::ostream& os,
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
bool cmExportFileGenerator::PopulateInterfaceLinkLibrariesProperty( bool cmExportFileGenerator::PopulateInterfaceLinkLibrariesProperty(
cmTarget *target, cmGeneratorTarget *target,
cmGeneratorExpression::PreprocessContext preprocessRule, cmGeneratorExpression::PreprocessContext preprocessRule,
ImportPropertyMap &properties, ImportPropertyMap &properties,
std::vector<std::string> &missingTargets) std::vector<std::string> &missingTargets)
@ -398,11 +397,11 @@ void cmExportFileGenerator::PopulateSourcesInterface(
ImportPropertyMap &properties, ImportPropertyMap &properties,
std::vector<std::string> &missingTargets) std::vector<std::string> &missingTargets)
{ {
cmTarget *target = tei->Target; cmGeneratorTarget* gt = tei->Target;
assert(preprocessRule == cmGeneratorExpression::InstallInterface); assert(preprocessRule == cmGeneratorExpression::InstallInterface);
const char *propName = "INTERFACE_SOURCES"; const char *propName = "INTERFACE_SOURCES";
const char *input = target->GetProperty(propName); const char *input = gt->GetProperty(propName);
if (!input) if (!input)
{ {
@ -420,11 +419,9 @@ void cmExportFileGenerator::PopulateSourcesInterface(
true); true);
if (!prepro.empty()) if (!prepro.empty())
{ {
this->ResolveTargetsInGeneratorExpressions(prepro, target, this->ResolveTargetsInGeneratorExpressions(prepro, gt,
missingTargets); missingTargets);
cmGeneratorTarget* gt = target->GetMakefile()
->GetGlobalGenerator()->GetGeneratorTarget(target);
if (!checkInterfaceDirs(prepro, gt, propName)) if (!checkInterfaceDirs(prepro, gt, propName))
{ {
return; return;
@ -440,9 +437,7 @@ void cmExportFileGenerator::PopulateIncludeDirectoriesInterface(
ImportPropertyMap &properties, ImportPropertyMap &properties,
std::vector<std::string> &missingTargets) std::vector<std::string> &missingTargets)
{ {
cmGeneratorTarget *target = tei->Target->GetMakefile() cmGeneratorTarget *target = tei->Target;
->GetGlobalGenerator()
->GetGeneratorTarget(tei->Target);
assert(preprocessRule == cmGeneratorExpression::InstallInterface); assert(preprocessRule == cmGeneratorExpression::InstallInterface);
const char *propName = "INTERFACE_INCLUDE_DIRECTORIES"; const char *propName = "INTERFACE_INCLUDE_DIRECTORIES";
@ -492,7 +487,7 @@ void cmExportFileGenerator::PopulateIncludeDirectoriesInterface(
true); true);
if (!prepro.empty()) if (!prepro.empty())
{ {
this->ResolveTargetsInGeneratorExpressions(prepro, target->Target, this->ResolveTargetsInGeneratorExpressions(prepro, target,
missingTargets); missingTargets);
if (!checkInterfaceDirs(prepro, target, propName)) if (!checkInterfaceDirs(prepro, target, propName))
@ -506,7 +501,7 @@ void cmExportFileGenerator::PopulateIncludeDirectoriesInterface(
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void cmExportFileGenerator::PopulateInterfaceProperty( void cmExportFileGenerator::PopulateInterfaceProperty(
const std::string& propName, const std::string& propName,
cmTarget *target, cmGeneratorTarget* target,
cmGeneratorExpression::PreprocessContext preprocessRule, cmGeneratorExpression::PreprocessContext preprocessRule,
ImportPropertyMap &properties, ImportPropertyMap &properties,
std::vector<std::string> &missingTargets) std::vector<std::string> &missingTargets)
@ -578,15 +573,14 @@ void cmExportFileGenerator::PopulateCompatibleInterfaceProperties(
cmGeneratorTarget *gtarget, cmGeneratorTarget *gtarget,
ImportPropertyMap &properties) ImportPropertyMap &properties)
{ {
cmTarget *target = gtarget->Target;
this->PopulateInterfaceProperty("COMPATIBLE_INTERFACE_BOOL", this->PopulateInterfaceProperty("COMPATIBLE_INTERFACE_BOOL",
target, properties); gtarget, properties);
this->PopulateInterfaceProperty("COMPATIBLE_INTERFACE_STRING", this->PopulateInterfaceProperty("COMPATIBLE_INTERFACE_STRING",
target, properties); gtarget, properties);
this->PopulateInterfaceProperty("COMPATIBLE_INTERFACE_NUMBER_MIN", this->PopulateInterfaceProperty("COMPATIBLE_INTERFACE_NUMBER_MIN",
target, properties); gtarget, properties);
this->PopulateInterfaceProperty("COMPATIBLE_INTERFACE_NUMBER_MAX", this->PopulateInterfaceProperty("COMPATIBLE_INTERFACE_NUMBER_MAX",
target, properties); gtarget, properties);
std::set<std::string> ifaceProperties; std::set<std::string> ifaceProperties;
@ -597,12 +591,12 @@ void cmExportFileGenerator::PopulateCompatibleInterfaceProperties(
getPropertyContents(gtarget, "COMPATIBLE_INTERFACE_NUMBER_MAX", getPropertyContents(gtarget, "COMPATIBLE_INTERFACE_NUMBER_MAX",
ifaceProperties); ifaceProperties);
if (target->GetType() != cmState::INTERFACE_LIBRARY) if (gtarget->GetType() != cmState::INTERFACE_LIBRARY)
{ {
getCompatibleInterfaceProperties(gtarget, ifaceProperties, ""); getCompatibleInterfaceProperties(gtarget, ifaceProperties, "");
std::vector<std::string> configNames; std::vector<std::string> configNames;
target->GetMakefile()->GetConfigurations(configNames); gtarget->Target->GetMakefile()->GetConfigurations(configNames);
for (std::vector<std::string>::const_iterator ci = configNames.begin(); for (std::vector<std::string>::const_iterator ci = configNames.begin();
ci != configNames.end(); ++ci) ci != configNames.end(); ++ci)
@ -615,12 +609,13 @@ void cmExportFileGenerator::PopulateCompatibleInterfaceProperties(
it != ifaceProperties.end(); ++it) it != ifaceProperties.end(); ++it)
{ {
this->PopulateInterfaceProperty("INTERFACE_" + *it, this->PopulateInterfaceProperty("INTERFACE_" + *it,
target, properties); gtarget, properties);
} }
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void cmExportFileGenerator::GenerateInterfaceProperties(cmTarget const* target, void cmExportFileGenerator::GenerateInterfaceProperties(
const cmGeneratorTarget* target,
std::ostream& os, std::ostream& os,
const ImportPropertyMap &properties) const ImportPropertyMap &properties)
{ {
@ -642,12 +637,12 @@ void cmExportFileGenerator::GenerateInterfaceProperties(cmTarget const* target,
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
bool bool
cmExportFileGenerator::AddTargetNamespace(std::string &input, cmExportFileGenerator::AddTargetNamespace(std::string &input,
cmTarget* target, cmGeneratorTarget* target,
std::vector<std::string> &missingTargets) std::vector<std::string> &missingTargets)
{ {
cmMakefile *mf = target->GetMakefile(); cmLocalGenerator *lg = target->GetLocalGenerator();
cmTarget *tgt = mf->FindTargetToUse(input); cmGeneratorTarget *tgt = lg->FindGeneratorTargetToUse(input);
if (!tgt) if (!tgt)
{ {
return false; return false;
@ -665,7 +660,7 @@ cmExportFileGenerator::AddTargetNamespace(std::string &input,
{ {
std::string namespacedTarget; std::string namespacedTarget;
this->HandleMissingTarget(namespacedTarget, missingTargets, this->HandleMissingTarget(namespacedTarget, missingTargets,
mf, target, tgt); target, tgt);
if (!namespacedTarget.empty()) if (!namespacedTarget.empty())
{ {
input = namespacedTarget; input = namespacedTarget;
@ -678,7 +673,7 @@ cmExportFileGenerator::AddTargetNamespace(std::string &input,
void void
cmExportFileGenerator::ResolveTargetsInGeneratorExpressions( cmExportFileGenerator::ResolveTargetsInGeneratorExpressions(
std::string &input, std::string &input,
cmTarget* target, cmGeneratorTarget* target,
std::vector<std::string> &missingTargets, std::vector<std::string> &missingTargets,
FreeTargetsReplace replace) FreeTargetsReplace replace)
{ {
@ -715,14 +710,12 @@ cmExportFileGenerator::ResolveTargetsInGeneratorExpressions(
void void
cmExportFileGenerator::ResolveTargetsInGeneratorExpression( cmExportFileGenerator::ResolveTargetsInGeneratorExpression(
std::string &input, std::string &input,
cmTarget* target, cmGeneratorTarget* target,
std::vector<std::string> &missingTargets) std::vector<std::string> &missingTargets)
{ {
std::string::size_type pos = 0; std::string::size_type pos = 0;
std::string::size_type lastPos = pos; std::string::size_type lastPos = pos;
cmMakefile *mf = target->GetMakefile();
while((pos = input.find("$<TARGET_PROPERTY:", lastPos)) != input.npos) while((pos = input.find("$<TARGET_PROPERTY:", lastPos)) != input.npos)
{ {
std::string::size_type nameStartPos = pos + std::string::size_type nameStartPos = pos +
@ -783,7 +776,7 @@ cmExportFileGenerator::ResolveTargetsInGeneratorExpression(
if (!errorString.empty()) if (!errorString.empty())
{ {
mf->IssueMessage(cmake::FATAL_ERROR, errorString); target->GetLocalGenerator()->IssueMessage(cmake::FATAL_ERROR, errorString);
} }
} }
@ -864,7 +857,7 @@ cmExportFileGenerator
preprocessRule); preprocessRule);
if (!prepro.empty()) if (!prepro.empty())
{ {
this->ResolveTargetsInGeneratorExpressions(prepro, target->Target, this->ResolveTargetsInGeneratorExpressions(prepro, target,
missingTargets, missingTargets,
ReplaceFreeTargets); ReplaceFreeTargets);
properties["IMPORTED_LINK_INTERFACE_LIBRARIES" + suffix] = prepro; properties["IMPORTED_LINK_INTERFACE_LIBRARIES" + suffix] = prepro;
@ -966,7 +959,7 @@ cmExportFileGenerator
sep = ";"; sep = ";";
std::string temp = *li; std::string temp = *li;
this->AddTargetNamespace(temp, target->Target, missingTargets); this->AddTargetNamespace(temp, target, missingTargets);
link_entries += temp; link_entries += temp;
} }
@ -1048,7 +1041,7 @@ void cmExportFileGenerator::GenerateExpectedTargetsCode(std::ostream& os,
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void void
cmExportFileGenerator cmExportFileGenerator
::GenerateImportTargetCode(std::ostream& os, cmTarget const* target) ::GenerateImportTargetCode(std::ostream& os, const cmGeneratorTarget* target)
{ {
// Construct the imported target name. // Construct the imported target name.
std::string targetName = this->Namespace; std::string targetName = this->Namespace;
@ -1082,7 +1075,7 @@ cmExportFileGenerator
} }
// Mark the imported executable if it has exports. // Mark the imported executable if it has exports.
if(target->IsExecutableWithExports()) if(target->Target->IsExecutableWithExports())
{ {
os << "set_property(TARGET " << targetName os << "set_property(TARGET " << targetName
<< " PROPERTY ENABLE_EXPORTS 1)\n"; << " PROPERTY ENABLE_EXPORTS 1)\n";
@ -1114,7 +1107,7 @@ cmExportFileGenerator
void void
cmExportFileGenerator cmExportFileGenerator
::GenerateImportPropertyCode(std::ostream& os, const std::string& config, ::GenerateImportPropertyCode(std::ostream& os, const std::string& config,
cmTarget const* target, cmGeneratorTarget const* target,
ImportPropertyMap const& properties) ImportPropertyMap const& properties)
{ {
// Construct the imported target name. // Construct the imported target name.
@ -1234,7 +1227,7 @@ cmExportFileGenerator::GenerateImportedFileCheckLoop(std::ostream& os)
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void void
cmExportFileGenerator cmExportFileGenerator
::GenerateImportedFileChecksCode(std::ostream& os, cmTarget* target, ::GenerateImportedFileChecksCode(std::ostream& os, cmGeneratorTarget* target,
ImportPropertyMap const& properties, ImportPropertyMap const& properties,
const std::set<std::string>& importedLocations) const std::set<std::string>& importedLocations)
{ {

View File

@ -75,11 +75,13 @@ protected:
const std::string& config = ""); const std::string& config = "");
void GenerateImportFooterCode(std::ostream& os); void GenerateImportFooterCode(std::ostream& os);
void GenerateImportVersionCode(std::ostream& os); void GenerateImportVersionCode(std::ostream& os);
void GenerateImportTargetCode(std::ostream& os, cmTarget const* target); void GenerateImportTargetCode(std::ostream& os,
cmGeneratorTarget const* target);
void GenerateImportPropertyCode(std::ostream& os, const std::string& config, void GenerateImportPropertyCode(std::ostream& os, const std::string& config,
cmTarget const* target, cmGeneratorTarget const* target,
ImportPropertyMap const& properties); ImportPropertyMap const& properties);
void GenerateImportedFileChecksCode(std::ostream& os, cmTarget* target, void GenerateImportedFileChecksCode(std::ostream& os,
cmGeneratorTarget* target,
ImportPropertyMap const& properties, ImportPropertyMap const& properties,
const std::set<std::string>& importedLocations); const std::set<std::string>& importedLocations);
void GenerateImportedFileCheckLoop(std::ostream& os); void GenerateImportedFileCheckLoop(std::ostream& os);
@ -118,23 +120,24 @@ protected:
* export set. */ * export set. */
virtual void HandleMissingTarget(std::string& link_libs, virtual void HandleMissingTarget(std::string& link_libs,
std::vector<std::string>& missingTargets, std::vector<std::string>& missingTargets,
cmMakefile* mf, cmGeneratorTarget* depender,
cmTarget* depender, cmGeneratorTarget* dependee) = 0;
cmTarget* dependee) = 0;
void PopulateInterfaceProperty(const std::string&, void PopulateInterfaceProperty(const std::string&,
cmTarget *target, cmGeneratorTarget *target,
cmGeneratorExpression::PreprocessContext, cmGeneratorExpression::PreprocessContext,
ImportPropertyMap &properties, ImportPropertyMap &properties,
std::vector<std::string> &missingTargets); std::vector<std::string> &missingTargets);
bool PopulateInterfaceLinkLibrariesProperty(cmTarget *target, bool PopulateInterfaceLinkLibrariesProperty(cmGeneratorTarget* target,
cmGeneratorExpression::PreprocessContext, cmGeneratorExpression::PreprocessContext,
ImportPropertyMap &properties, ImportPropertyMap &properties,
std::vector<std::string> &missingTargets); std::vector<std::string> &missingTargets);
void PopulateInterfaceProperty(const std::string& propName, cmTarget *target, void PopulateInterfaceProperty(const std::string& propName,
cmGeneratorTarget* target,
ImportPropertyMap &properties); ImportPropertyMap &properties);
void PopulateCompatibleInterfaceProperties(cmGeneratorTarget *target, void PopulateCompatibleInterfaceProperties(cmGeneratorTarget *target,
ImportPropertyMap &properties); ImportPropertyMap &properties);
void GenerateInterfaceProperties(cmTarget const* target, std::ostream& os, void GenerateInterfaceProperties(cmGeneratorTarget const* target,
std::ostream& os,
const ImportPropertyMap &properties); const ImportPropertyMap &properties);
void PopulateIncludeDirectoriesInterface( void PopulateIncludeDirectoriesInterface(
cmTargetExport *target, cmTargetExport *target,
@ -159,7 +162,7 @@ protected:
}; };
void ResolveTargetsInGeneratorExpressions(std::string &input, void ResolveTargetsInGeneratorExpressions(std::string &input,
cmTarget* target, cmGeneratorTarget* target,
std::vector<std::string> &missingTargets, std::vector<std::string> &missingTargets,
FreeTargetsReplace replace = NoReplaceFreeTargets); FreeTargetsReplace replace = NoReplaceFreeTargets);
@ -182,20 +185,20 @@ protected:
bool AppendMode; bool AppendMode;
// The set of targets included in the export. // The set of targets included in the export.
std::set<cmTarget*> ExportedTargets; std::set<cmGeneratorTarget*> ExportedTargets;
private: private:
void PopulateInterfaceProperty(const std::string&, const std::string&, void PopulateInterfaceProperty(const std::string&, const std::string&,
cmTarget *target, cmGeneratorTarget* target,
cmGeneratorExpression::PreprocessContext, cmGeneratorExpression::PreprocessContext,
ImportPropertyMap &properties, ImportPropertyMap &properties,
std::vector<std::string> &missingTargets); std::vector<std::string> &missingTargets);
bool AddTargetNamespace(std::string &input, cmTarget* target, bool AddTargetNamespace(std::string &input, cmGeneratorTarget* target,
std::vector<std::string> &missingTargets); std::vector<std::string> &missingTargets);
void ResolveTargetsInGeneratorExpression(std::string &input, void ResolveTargetsInGeneratorExpression(std::string &input,
cmTarget* target, cmGeneratorTarget* target,
std::vector<std::string> &missingTargets); std::vector<std::string> &missingTargets);
virtual void ReplaceInstallPrefix(std::string &input); virtual void ReplaceInstallPrefix(std::string &input);

View File

@ -48,7 +48,8 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os)
tei = this->IEGen->GetExportSet()->GetTargetExports()->begin(); tei = this->IEGen->GetExportSet()->GetTargetExports()->begin();
tei != this->IEGen->GetExportSet()->GetTargetExports()->end(); ++tei) tei != this->IEGen->GetExportSet()->GetTargetExports()->end(); ++tei)
{ {
expectedTargets += sep + this->Namespace + (*tei)->Target->GetExportName(); expectedTargets +=
sep + this->Namespace + (*tei)->Target->GetExportName();
sep = " "; sep = " ";
cmTargetExport * te = *tei; cmTargetExport * te = *tei;
if(this->ExportedTargets.insert(te->Target).second) if(this->ExportedTargets.insert(te->Target).second)
@ -131,12 +132,12 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os)
tei = allTargets.begin(); tei = allTargets.begin();
tei != allTargets.end(); ++tei) tei != allTargets.end(); ++tei)
{ {
cmTarget* te = (*tei)->Target; cmGeneratorTarget* gt = (*tei)->Target;
requiresConfigFiles = requiresConfigFiles requiresConfigFiles = requiresConfigFiles
|| te->GetType() != cmState::INTERFACE_LIBRARY; || gt->GetType() != cmState::INTERFACE_LIBRARY;
this->GenerateImportTargetCode(os, te); this->GenerateImportTargetCode(os, gt);
ImportPropertyMap properties; ImportPropertyMap properties;
@ -147,32 +148,32 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os)
cmGeneratorExpression::InstallInterface, cmGeneratorExpression::InstallInterface,
properties, missingTargets); properties, missingTargets);
this->PopulateInterfaceProperty("INTERFACE_SYSTEM_INCLUDE_DIRECTORIES", this->PopulateInterfaceProperty("INTERFACE_SYSTEM_INCLUDE_DIRECTORIES",
te, gt,
cmGeneratorExpression::InstallInterface, cmGeneratorExpression::InstallInterface,
properties, missingTargets); properties, missingTargets);
this->PopulateInterfaceProperty("INTERFACE_COMPILE_DEFINITIONS", this->PopulateInterfaceProperty("INTERFACE_COMPILE_DEFINITIONS",
te, gt,
cmGeneratorExpression::InstallInterface, cmGeneratorExpression::InstallInterface,
properties, missingTargets); properties, missingTargets);
this->PopulateInterfaceProperty("INTERFACE_COMPILE_OPTIONS", this->PopulateInterfaceProperty("INTERFACE_COMPILE_OPTIONS",
te, gt,
cmGeneratorExpression::InstallInterface, cmGeneratorExpression::InstallInterface,
properties, missingTargets); properties, missingTargets);
this->PopulateInterfaceProperty("INTERFACE_AUTOUIC_OPTIONS", this->PopulateInterfaceProperty("INTERFACE_AUTOUIC_OPTIONS",
te, gt,
cmGeneratorExpression::InstallInterface, cmGeneratorExpression::InstallInterface,
properties, missingTargets); properties, missingTargets);
this->PopulateInterfaceProperty("INTERFACE_COMPILE_FEATURES", this->PopulateInterfaceProperty("INTERFACE_COMPILE_FEATURES",
te, gt,
cmGeneratorExpression::InstallInterface, cmGeneratorExpression::InstallInterface,
properties, missingTargets); properties, missingTargets);
const bool newCMP0022Behavior = const bool newCMP0022Behavior =
te->GetPolicyStatusCMP0022() != cmPolicies::WARN gt->Target->GetPolicyStatusCMP0022() != cmPolicies::WARN
&& te->GetPolicyStatusCMP0022() != cmPolicies::OLD; && gt->Target->GetPolicyStatusCMP0022() != cmPolicies::OLD;
if (newCMP0022Behavior) if (newCMP0022Behavior)
{ {
if (this->PopulateInterfaceLinkLibrariesProperty(te, if (this->PopulateInterfaceLinkLibrariesProperty(gt,
cmGeneratorExpression::InstallInterface, cmGeneratorExpression::InstallInterface,
properties, missingTargets) properties, missingTargets)
&& !this->ExportOld) && !this->ExportOld)
@ -180,11 +181,11 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os)
require2_8_12 = true; require2_8_12 = true;
} }
} }
if (te->GetType() == cmState::INTERFACE_LIBRARY) if (gt->GetType() == cmState::INTERFACE_LIBRARY)
{ {
require3_0_0 = true; require3_0_0 = true;
} }
if(te->GetProperty("INTERFACE_SOURCES")) if(gt->GetProperty("INTERFACE_SOURCES"))
{ {
// We can only generate INTERFACE_SOURCES in CMake 3.3, but CMake 3.1 // We can only generate INTERFACE_SOURCES in CMake 3.3, but CMake 3.1
// can consume them. // can consume them.
@ -192,14 +193,11 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os)
} }
this->PopulateInterfaceProperty("INTERFACE_POSITION_INDEPENDENT_CODE", this->PopulateInterfaceProperty("INTERFACE_POSITION_INDEPENDENT_CODE",
te, properties); gt, properties);
cmGeneratorTarget *gtgt = te->GetMakefile()
->GetGlobalGenerator()
->GetGeneratorTarget(te);
this->PopulateCompatibleInterfaceProperties(gtgt, properties); this->PopulateCompatibleInterfaceProperties(gt, properties);
this->GenerateInterfaceProperties(te, os, properties); this->GenerateInterfaceProperties(gt, os, properties);
} }
if (require3_1_0) if (require3_1_0)
@ -362,8 +360,7 @@ cmExportInstallFileGenerator
if(!properties.empty()) if(!properties.empty())
{ {
// Get the rest of the target details. // Get the rest of the target details.
cmGeneratorTarget *gtgt = te->Target->GetMakefile() cmGeneratorTarget *gtgt = te->Target;
->GetGlobalGenerator()->GetGeneratorTarget(te->Target);
this->SetImportDetailProperties(config, suffix, this->SetImportDetailProperties(config, suffix,
gtgt, properties, missingTargets); gtgt, properties, missingTargets);
@ -378,8 +375,8 @@ cmExportInstallFileGenerator
// properties); // properties);
// Generate code in the export file. // Generate code in the export file.
this->GenerateImportPropertyCode(os, config, te->Target, properties); this->GenerateImportPropertyCode(os, config, gtgt, properties);
this->GenerateImportedFileChecksCode(os, te->Target, properties, this->GenerateImportedFileChecksCode(os, gtgt, properties,
importedLocations); importedLocations);
} }
} }
@ -402,7 +399,7 @@ cmExportInstallFileGenerator
} }
// Get the target to be installed. // Get the target to be installed.
cmTarget* target = itgen->GetTarget()->Target; cmGeneratorTarget* target = itgen->GetTarget();
// Construct the installed location of the target. // Construct the installed location of the target.
std::string dest = itgen->GetDestination(config); std::string dest = itgen->GetDestination(config);
@ -456,12 +453,13 @@ cmExportInstallFileGenerator
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void void
cmExportInstallFileGenerator::HandleMissingTarget( cmExportInstallFileGenerator::HandleMissingTarget(std::string& link_libs,
std::string& link_libs, std::vector<std::string>& missingTargets, std::vector<std::string>& missingTargets,
cmMakefile* mf, cmTarget* depender, cmTarget* dependee) cmGeneratorTarget* depender, cmGeneratorTarget* dependee)
{ {
const std::string name = dependee->GetName(); const std::string name = dependee->GetName();
std::vector<std::string> namespaces = this->FindNamespaces(mf, name); cmGlobalGenerator* gg = dependee->GetLocalGenerator()->GetGlobalGenerator();
std::vector<std::string> namespaces = this->FindNamespaces(gg, name);
int targetOccurrences = (int)namespaces.size(); int targetOccurrences = (int)namespaces.size();
if (targetOccurrences == 1) if (targetOccurrences == 1)
{ {
@ -482,10 +480,9 @@ cmExportInstallFileGenerator::HandleMissingTarget(
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
std::vector<std::string> std::vector<std::string>
cmExportInstallFileGenerator cmExportInstallFileGenerator
::FindNamespaces(cmMakefile* mf, const std::string& name) ::FindNamespaces(cmGlobalGenerator* gg, const std::string& name)
{ {
std::vector<std::string> namespaces; std::vector<std::string> namespaces;
cmGlobalGenerator* gg = mf->GetGlobalGenerator();
const cmExportSetMap& exportSets = gg->GetExportSets(); const cmExportSetMap& exportSets = gg->GetExportSets();
for(cmExportSetMap::const_iterator expIt = exportSets.begin(); for(cmExportSetMap::const_iterator expIt = exportSets.begin();
@ -523,8 +520,8 @@ cmExportInstallFileGenerator
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void void
cmExportInstallFileGenerator cmExportInstallFileGenerator
::ComplainAboutMissingTarget(cmTarget* depender, ::ComplainAboutMissingTarget(cmGeneratorTarget* depender,
cmTarget* dependee, cmGeneratorTarget* dependee,
int occurrences) int occurrences)
{ {
std::ostringstream e; std::ostringstream e;

View File

@ -57,17 +57,16 @@ protected:
std::vector<std::string> &missingTargets); std::vector<std::string> &missingTargets);
virtual void HandleMissingTarget(std::string& link_libs, virtual void HandleMissingTarget(std::string& link_libs,
std::vector<std::string>& missingTargets, std::vector<std::string>& missingTargets,
cmMakefile* mf, cmGeneratorTarget* depender,
cmTarget* depender, cmGeneratorTarget* dependee);
cmTarget* dependee);
virtual void ReplaceInstallPrefix(std::string &input); virtual void ReplaceInstallPrefix(std::string &input);
void ComplainAboutMissingTarget(cmTarget* depender, void ComplainAboutMissingTarget(cmGeneratorTarget* depender,
cmTarget* dependee, cmGeneratorTarget* dependee,
int occurrences); int occurrences);
std::vector<std::string> FindNamespaces(cmMakefile* mf, std::vector<std::string> FindNamespaces(cmGlobalGenerator* gg,
const std::string& name); const std::string& name);

View File

@ -13,12 +13,22 @@
#include "cmExportSet.h" #include "cmExportSet.h"
#include "cmTargetExport.h" #include "cmTargetExport.h"
#include "cmAlgorithms.h" #include "cmAlgorithms.h"
#include "cmLocalGenerator.h"
cmExportSet::~cmExportSet() cmExportSet::~cmExportSet()
{ {
cmDeleteAll(this->TargetExports); cmDeleteAll(this->TargetExports);
} }
void cmExportSet::Compute(cmLocalGenerator* lg)
{
for (std::vector<cmTargetExport*>::iterator it = this->TargetExports.begin();
it != this->TargetExports.end(); ++it)
{
(*it)->Target = lg->FindGeneratorTargetToUse((*it)->TargetName);
}
}
void cmExportSet::AddTargetExport(cmTargetExport* te) void cmExportSet::AddTargetExport(cmTargetExport* te)
{ {
this->TargetExports.push_back(te); this->TargetExports.push_back(te);

View File

@ -15,6 +15,7 @@
#include "cmSystemTools.h" #include "cmSystemTools.h"
class cmTargetExport; class cmTargetExport;
class cmInstallExportGenerator; class cmInstallExportGenerator;
class cmLocalGenerator;
/// A set of targets that were installed with the same EXPORT parameter. /// A set of targets that were installed with the same EXPORT parameter.
class cmExportSet class cmExportSet
@ -25,6 +26,8 @@ public:
/// Destructor /// Destructor
~cmExportSet(); ~cmExportSet();
void Compute(cmLocalGenerator* lg);
void AddTargetExport(cmTargetExport* tgt); void AddTargetExport(cmTargetExport* tgt);
void AddInstallation(cmInstallExportGenerator const* installation); void AddInstallation(cmInstallExportGenerator const* installation);

View File

@ -14,22 +14,25 @@
#include "cmGeneratedFileStream.h" #include "cmGeneratedFileStream.h"
#include "cmGlobalGenerator.h" #include "cmGlobalGenerator.h"
#include "cmLocalGenerator.h"
#include "cmGeneratorExpressionDAGChecker.h" #include "cmGeneratorExpressionDAGChecker.h"
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
cmExportTryCompileFileGenerator::cmExportTryCompileFileGenerator( cmExportTryCompileFileGenerator::cmExportTryCompileFileGenerator(
cmGlobalGenerator* gg) cmGlobalGenerator* gg,
const std::vector<std::string>& targets,
cmMakefile* mf)
{ {
gg->CreateGenerationObjects(cmGlobalGenerator::ImportedOnly); gg->CreateImportedGenerationObjects(mf, targets, this->Exports);
} }
bool cmExportTryCompileFileGenerator::GenerateMainFile(std::ostream& os) bool cmExportTryCompileFileGenerator::GenerateMainFile(std::ostream& os)
{ {
std::set<cmTarget const*> emitted; std::set<cmGeneratorTarget const*> emitted;
std::set<cmTarget const*> emittedDeps; std::set<cmGeneratorTarget const*> emittedDeps;
while(!this->Exports.empty()) while(!this->Exports.empty())
{ {
cmTarget const* te = this->Exports.back(); cmGeneratorTarget const* te = this->Exports.back();
this->Exports.pop_back(); this->Exports.pop_back();
if (emitted.insert(te).second) if (emitted.insert(te).second)
{ {
@ -55,8 +58,8 @@ bool cmExportTryCompileFileGenerator::GenerateMainFile(std::ostream& os)
std::string cmExportTryCompileFileGenerator::FindTargets( std::string cmExportTryCompileFileGenerator::FindTargets(
const std::string& propName, const std::string& propName,
cmTarget const* tgt, cmGeneratorTarget const* tgt,
std::set<cmTarget const*> &emitted) std::set<cmGeneratorTarget const*> &emitted)
{ {
const char *prop = tgt->GetProperty(propName); const char *prop = tgt->GetProperty(propName);
if(!prop) if(!prop)
@ -74,24 +77,22 @@ std::string cmExportTryCompileFileGenerator::FindTargets(
cmTarget dummyHead; cmTarget dummyHead;
dummyHead.SetType(cmState::EXECUTABLE, "try_compile_dummy_exe"); dummyHead.SetType(cmState::EXECUTABLE, "try_compile_dummy_exe");
dummyHead.SetMakefile(tgt->GetMakefile()); dummyHead.SetMakefile(tgt->Target->GetMakefile());
cmGeneratorTarget* gtgt = cmGeneratorTarget gDummyHead(&dummyHead, tgt->GetLocalGenerator());
tgt->GetMakefile()->GetGlobalGenerator()->GetGeneratorTarget(tgt);
cmGeneratorTarget gDummyHead(&dummyHead, gtgt->GetLocalGenerator());
std::string result = cge->Evaluate(gtgt->GetLocalGenerator(), this->Config, std::string result = cge->Evaluate(tgt->GetLocalGenerator(), this->Config,
false, &gDummyHead, false, &gDummyHead,
gtgt, &dagChecker); tgt, &dagChecker);
const std::set<cmGeneratorTarget const*> &allTargets = const std::set<cmGeneratorTarget const*> &allTargets =
cge->GetAllTargetsSeen(); cge->GetAllTargetsSeen();
for(std::set<cmGeneratorTarget const*>::const_iterator li = for(std::set<cmGeneratorTarget const*>::const_iterator li =
allTargets.begin(); li != allTargets.end(); ++li) allTargets.begin(); li != allTargets.end(); ++li)
{ {
if(emitted.insert((*li)->Target).second) if(emitted.insert(*li).second)
{ {
this->Exports.push_back((*li)->Target); this->Exports.push_back(*li);
} }
} }
return result; return result;
@ -99,11 +100,12 @@ std::string cmExportTryCompileFileGenerator::FindTargets(
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void void
cmExportTryCompileFileGenerator::PopulateProperties(cmTarget const* target, cmExportTryCompileFileGenerator::PopulateProperties(
const cmGeneratorTarget* target,
ImportPropertyMap& properties, ImportPropertyMap& properties,
std::set<cmTarget const*> &emitted) std::set<cmGeneratorTarget const*> &emitted)
{ {
cmPropertyMap props = target->GetProperties(); cmPropertyMap props = target->Target->GetProperties();
for(cmPropertyMap::const_iterator i = props.begin(); i != props.end(); ++i) for(cmPropertyMap::const_iterator i = props.begin(); i != props.end(); ++i)
{ {
properties[i->first] = i->second.GetValue(); properties[i->first] = i->second.GetValue();
@ -120,7 +122,8 @@ cmExportTryCompileFileGenerator::PopulateProperties(cmTarget const* target,
for(std::vector<std::string>::const_iterator li = depends.begin(); for(std::vector<std::string>::const_iterator li = depends.begin();
li != depends.end(); ++li) li != depends.end(); ++li)
{ {
cmTarget *tgt = target->GetMakefile()->FindTargetToUse(*li); cmGeneratorTarget *tgt =
target->GetLocalGenerator()->FindGeneratorTargetToUse(*li);
if(tgt && emitted.insert(tgt).second) if(tgt && emitted.insert(tgt).second)
{ {
this->Exports.push_back(tgt); this->Exports.push_back(tgt);

View File

@ -20,11 +20,11 @@ class cmInstallTargetGenerator;
class cmExportTryCompileFileGenerator: public cmExportFileGenerator class cmExportTryCompileFileGenerator: public cmExportFileGenerator
{ {
public: public:
cmExportTryCompileFileGenerator(cmGlobalGenerator* gg); cmExportTryCompileFileGenerator(cmGlobalGenerator* gg,
std::vector<std::string> const& targets,
cmMakefile* mf);
/** Set the list of targets to export. */ /** Set the list of targets to export. */
void SetExports(const std::vector<cmTarget const*> &exports)
{ this->Exports = exports; }
void SetConfig(const std::string& config) { this->Config = config; } void SetConfig(const std::string& config) { this->Config = config; }
protected: protected:
@ -37,22 +37,22 @@ protected:
std::vector<std::string>&) {} std::vector<std::string>&) {}
virtual void HandleMissingTarget(std::string&, virtual void HandleMissingTarget(std::string&,
std::vector<std::string>&, std::vector<std::string>&,
cmMakefile*, cmGeneratorTarget*,
cmTarget*, cmGeneratorTarget*) {}
cmTarget*) {}
void PopulateProperties(cmTarget const* target, void PopulateProperties(cmGeneratorTarget const* target,
ImportPropertyMap& properties, ImportPropertyMap& properties,
std::set<cmTarget const*> &emitted); std::set<const cmGeneratorTarget*>& emitted);
std::string InstallNameDir(cmGeneratorTarget* target, std::string InstallNameDir(cmGeneratorTarget* target,
const std::string& config); const std::string& config);
private: private:
std::string FindTargets(const std::string& prop, cmTarget const* tgt, std::string FindTargets(const std::string& prop,
std::set<cmTarget const*> &emitted); const cmGeneratorTarget* tgt,
std::set<const cmGeneratorTarget*>& emitted);
std::vector<cmTarget const*> Exports; std::vector<cmGeneratorTarget const*> Exports;
std::string Config; std::string Config;
}; };

View File

@ -388,7 +388,7 @@ cmExtraSublimeTextGenerator::ComputeFlagsForObject(cmSourceFile* source,
// } // }
// Add shared-library flags if needed. // Add shared-library flags if needed.
lg->AddCMP0018Flags(flags, gtgt->Target, language, config); lg->AddCMP0018Flags(flags, gtgt, language, config);
// Add include directory flags. // Add include directory flags.
{ {
@ -403,7 +403,7 @@ cmExtraSublimeTextGenerator::ComputeFlagsForObject(cmSourceFile* source,
lg->AppendFlags(flags, makefile->GetDefineFlags()); lg->AppendFlags(flags, makefile->GetDefineFlags());
// Add target-specific flags. // Add target-specific flags.
lg->AddCompileOptions(flags, gtgt->Target, language, config); lg->AddCompileOptions(flags, gtgt, language, config);
// Add source file specific flags. // Add source file specific flags.
lg->AppendFlags(flags, source->GetProperty("COMPILE_FLAGS")); lg->AppendFlags(flags, source->GetProperty("COMPILE_FLAGS"));
@ -433,7 +433,7 @@ ComputeDefines(cmSourceFile *source, cmLocalGenerator* lg,
} }
// Add preprocessor definitions for this target and configuration. // Add preprocessor definitions for this target and configuration.
lg->AddCompileDefinitions(defines, target->Target, config, language); lg->AddCompileDefinitions(defines, target, config, language);
lg->AppendDefines(defines, source->GetProperty("COMPILE_DEFINITIONS")); lg->AppendDefines(defines, source->GetProperty("COMPILE_DEFINITIONS"));
{ {
std::string defPropName = "COMPILE_DEFINITIONS_"; std::string defPropName = "COMPILE_DEFINITIONS_";

View File

@ -1497,11 +1497,11 @@ static const struct TargetPolicyNode : public cmGeneratorExpressionNode
const char *policy = targetPolicyWhitelist[i]; const char *policy = targetPolicyWhitelist[i];
if (parameters.front() == policy) if (parameters.front() == policy)
{ {
cmMakefile *mf = context->HeadTarget->Target->GetMakefile(); cmLocalGenerator* lg = context->HeadTarget->GetLocalGenerator();
switch(statusForTarget(context->HeadTarget, policy)) switch(statusForTarget(context->HeadTarget, policy))
{ {
case cmPolicies::WARN: case cmPolicies::WARN:
mf->IssueMessage(cmake::AUTHOR_WARNING, lg->IssueMessage(cmake::AUTHOR_WARNING,
cmPolicies::GetPolicyWarning(policyForString(policy))); cmPolicies::GetPolicyWarning(policyForString(policy)));
case cmPolicies::REQUIRED_IF_USED: case cmPolicies::REQUIRED_IF_USED:
case cmPolicies::REQUIRED_ALWAYS: case cmPolicies::REQUIRED_ALWAYS:
@ -1654,7 +1654,7 @@ struct TargetFilesystemArtifactResultCreator<ArtifactLinkerTag>
const GeneratorExpressionContent *content) const GeneratorExpressionContent *content)
{ {
// The file used to link to the target (.so, .lib, .a). // The file used to link to the target (.so, .lib, .a).
if(!target->Target->IsLinkable()) if(!target->IsLinkable())
{ {
::reportError(context, content->GetOriginalExpression(), ::reportError(context, content->GetOriginalExpression(),
"TARGET_LINKER_FILE is allowed only for libraries and " "TARGET_LINKER_FILE is allowed only for libraries and "

File diff suppressed because it is too large Load Diff

View File

@ -43,6 +43,8 @@ public:
cmState::TargetType GetType() const; cmState::TargetType GetType() const;
std::string GetName() const; std::string GetName() const;
std::string GetExportName() const;
const char *GetProperty(const std::string& prop) const; const char *GetProperty(const std::string& prop) const;
bool GetPropertyAsBool(const std::string& prop) const; bool GetPropertyAsBool(const std::string& prop) const;
void GetSourceFiles(std::vector<cmSourceFile*>& files, void GetSourceFiles(std::vector<cmSourceFile*>& files,
@ -226,6 +228,12 @@ public:
void GetLanguages(std::set<std::string>& languages, void GetLanguages(std::set<std::string>& languages,
std::string const& config) const; std::string const& config) const;
void
GetObjectLibrariesCMP0026(std::vector<cmGeneratorTarget*>& objlibs) const;
std::string GetFullNameImported(const std::string& config,
bool implib) const;
bool GetConfigCommonSourceFiles(std::vector<cmSourceFile*>& files) const; bool GetConfigCommonSourceFiles(std::vector<cmSourceFile*>& files) const;
bool HaveBuildTreeRPATH(const std::string& config) const; bool HaveBuildTreeRPATH(const std::string& config) const;
@ -404,6 +412,22 @@ public:
/** Get a build-tree directory in which to place target support files. */ /** Get a build-tree directory in which to place target support files. */
std::string GetSupportDirectory() const; std::string GetSupportDirectory() const;
/** Return whether this target may be used to link another target. */
bool IsLinkable() const;
/** Return whether this target is a shared library Framework on
Apple. */
bool IsFrameworkOnApple() const;
/** Return whether this target is an executable Bundle on Apple. */
bool IsAppBundleOnApple() const;
/** Return whether this target is a XCTest on Apple. */
bool IsXCTestOnApple() const;
/** Return whether this target is a CFBundle (plugin) on Apple. */
bool IsCFBundleOnApple() const;
struct SourceFileFlags struct SourceFileFlags
GetTargetSourceFileFlags(const cmSourceFile* sf) const; GetTargetSourceFileFlags(const cmSourceFile* sf) const;
@ -437,6 +461,19 @@ public:
no soname at all. */ no soname at all. */
bool IsImportedSharedLibWithoutSOName(const std::string& config) const; bool IsImportedSharedLibWithoutSOName(const std::string& config) const;
const char* ImportedGetLocation(const std::string& config) const;
/** Get the target major and minor version numbers interpreted from
the VERSION property. Version 0 is returned if the property is
not set or cannot be parsed. */
void GetTargetVersion(int& major, int& minor) const;
/** Get the target major, minor, and patch version numbers
interpreted from the VERSION or SOVERSION property. Version 0
is returned if the property is not set or cannot be parsed. */
void
GetTargetVersion(bool soversion, int& major, int& minor, int& patch) const;
private: private:
friend class cmTargetTraceDependencies; friend class cmTargetTraceDependencies;
struct SourceEntry { std::vector<cmSourceFile*> Depends; }; struct SourceEntry { std::vector<cmSourceFile*> Depends; };
@ -464,6 +501,13 @@ private:
// Returns ARCHIVE, LIBRARY, or RUNTIME based on platform and type. // Returns ARCHIVE, LIBRARY, or RUNTIME based on platform and type.
const char* GetOutputTargetType(bool implib) const; const char* GetOutputTargetType(bool implib) const;
void ComputeVersionedName(std::string& vName,
std::string const& prefix,
std::string const& base,
std::string const& suffix,
std::string const& name,
const char* version) const;
struct CompatibleInterfacesBase struct CompatibleInterfacesBase
{ {
std::set<std::string> PropsBool; std::set<std::string> PropsBool;
@ -508,6 +552,31 @@ private:
cmHeadToLinkInterfaceMap& GetHeadToLinkInterfaceUsageRequirementsMap( cmHeadToLinkInterfaceMap& GetHeadToLinkInterfaceUsageRequirementsMap(
std::string const& config) const; std::string const& config) const;
// Cache import information from properties for each configuration.
struct ImportInfo
{
ImportInfo(): NoSOName(false), Multiplicity(0) {}
bool NoSOName;
int Multiplicity;
std::string Location;
std::string SOName;
std::string ImportLibrary;
std::string Languages;
std::string Libraries;
std::string LibrariesProp;
std::string SharedDeps;
};
typedef std::map<std::string, ImportInfo> ImportInfoMapType;
mutable ImportInfoMapType ImportInfoMap;
void ComputeImportInfo(std::string const& desired_config,
ImportInfo& info) const;
ImportInfo const* GetImportInfo(const std::string& config) const;
/** Strip off leading and trailing whitespace from an item named in
the link dependencies of this target. */
std::string CheckCMP0004(std::string const& item) const;
cmLinkInterface const* cmLinkInterface const*
GetImportLinkInterface(const std::string& config, GetImportLinkInterface(const std::string& config,
const cmGeneratorTarget* head, const cmGeneratorTarget* head,

View File

@ -265,8 +265,11 @@ void cmGhsMultiTargetGenerator::SetCompilerFlags(std::string const &config,
this->LocalGenerator->AddLanguageFlags( this->LocalGenerator->AddLanguageFlags(
flags, lang + std::string("_GHS_KERNEL"), config); flags, lang + std::string("_GHS_KERNEL"), config);
} }
this->LocalGenerator->AddCMP0018Flags(flags, this->Target, lang, config); this->LocalGenerator->AddCMP0018Flags(flags, this->GeneratorTarget,
this->LocalGenerator->AddVisibilityPresetFlags(flags, this->Target, lang); lang, config);
this->LocalGenerator->AddVisibilityPresetFlags(flags,
this->GeneratorTarget,
lang);
// Append old-style preprocessor definition flags. // Append old-style preprocessor definition flags.
if (std::string(" ") != std::string(this->Makefile->GetDefineFlags())) if (std::string(" ") != std::string(this->Makefile->GetDefineFlags()))
@ -276,7 +279,8 @@ void cmGhsMultiTargetGenerator::SetCompilerFlags(std::string const &config,
} }
// Add target-specific flags. // Add target-specific flags.
this->LocalGenerator->AddCompileOptions(flags, this->Target, lang, config); this->LocalGenerator->AddCompileOptions(flags, this->GeneratorTarget,
lang, config);
std::map<std::string, std::string>::value_type entry(language, flags); std::map<std::string, std::string>::value_type entry(language, flags);
i = this->FlagsByLanguage.insert(entry).first; i = this->FlagsByLanguage.insert(entry).first;
@ -299,7 +303,8 @@ std::string cmGhsMultiTargetGenerator::GetDefines(const std::string &language,
} }
// Add preprocessor definitions for this target and configuration. // Add preprocessor definitions for this target and configuration.
this->LocalGenerator->AddCompileDefinitions(defines, this->Target, config, this->LocalGenerator->AddCompileDefinitions(defines,
this->GeneratorTarget, config,
language); language);
std::string definesString; std::string definesString;

View File

@ -1199,6 +1199,27 @@ void cmGlobalGenerator::CreateGenerationObjects(TargetTypes targetTypes)
cmDeleteAll(this->GeneratorTargets); cmDeleteAll(this->GeneratorTargets);
this->GeneratorTargets.clear(); this->GeneratorTargets.clear();
this->CreateGeneratorTargets(targetTypes); this->CreateGeneratorTargets(targetTypes);
this->ComputeBuildFileGenerators();
}
void cmGlobalGenerator::CreateImportedGenerationObjects(cmMakefile* mf,
const std::vector<std::string>& targets,
std::vector<const cmGeneratorTarget*>& exports)
{
this->CreateGenerationObjects(ImportedOnly);
std::vector<cmMakefile*>::iterator mfit =
std::find(this->Makefiles.begin(), this->Makefiles.end(), mf);
cmLocalGenerator* lg =
this->LocalGenerators[std::distance(this->Makefiles.begin(), mfit)];
for (std::vector<std::string>::const_iterator it = targets.begin();
it != targets.end(); ++it)
{
cmGeneratorTarget* gt = lg->FindGeneratorTargetToUse(*it);
if (gt)
{
exports.push_back(gt);
}
}
} }
cmExportBuildFileGenerator* cmExportBuildFileGenerator*
@ -1279,8 +1300,6 @@ bool cmGlobalGenerator::Compute()
this->CreateQtAutoGeneratorsTargets(); this->CreateQtAutoGeneratorsTargets();
#endif #endif
this->ComputeBuildFileGenerators();
unsigned int i; unsigned int i;
// Add generator specific helper commands // Add generator specific helper commands
@ -2189,7 +2208,8 @@ cmGlobalGenerator::NameResolvesToFramework(const std::string& libname) const
if(cmTarget* tgt = this->FindTarget(libname)) if(cmTarget* tgt = this->FindTarget(libname))
{ {
if(tgt->IsFrameworkOnApple()) cmGeneratorTarget* gt = this->GetGeneratorTarget(tgt);
if(gt->IsFrameworkOnApple())
{ {
return true; return true;
} }

View File

@ -91,6 +91,9 @@ public:
ImportedOnly ImportedOnly
}; };
void CreateImportedGenerationObjects(cmMakefile* mf,
std::vector<std::string> const& targets,
std::vector<cmGeneratorTarget const*>& exports);
void CreateGenerationObjects(TargetTypes targetTypes = AllTargets); void CreateGenerationObjects(TargetTypes targetTypes = AllTargets);
/** /**
@ -365,8 +368,6 @@ public:
bool GetConfigureDoneCMP0026() const bool GetConfigureDoneCMP0026() const
{ return this->ConfigureDoneCMP0026AndCMP0024; } { return this->ConfigureDoneCMP0026AndCMP0024; }
void ComputeBuildFileGenerators();
std::string MakeSilentFlag; std::string MakeSilentFlag;
protected: protected:
typedef std::vector<cmLocalGenerator*> GeneratorVector; typedef std::vector<cmLocalGenerator*> GeneratorVector;
@ -471,6 +472,8 @@ private:
void CheckCompilerIdCompatibility(cmMakefile* mf, void CheckCompilerIdCompatibility(cmMakefile* mf,
std::string const& lang) const; std::string const& lang) const;
void ComputeBuildFileGenerators();
cmExternalMakefileProjectGenerator* ExtraGenerator; cmExternalMakefileProjectGenerator* ExtraGenerator;
// track files replaced during a Generate // track files replaced during a Generate

View File

@ -917,11 +917,13 @@ cmGlobalNinjaGenerator
std::string configName = std::string configName =
target->GetMakefile()->GetSafeDefinition("CMAKE_BUILD_TYPE"); target->GetMakefile()->GetSafeDefinition("CMAKE_BUILD_TYPE");
cmGeneratorTarget *gtgt = this->GetGeneratorTarget(target);
// for frameworks, we want the real name, not smple name // for frameworks, we want the real name, not smple name
// frameworks always appear versioned, and the build.ninja // frameworks always appear versioned, and the build.ninja
// will always attempt to manage symbolic links instead // will always attempt to manage symbolic links instead
// of letting cmOSXBundleGenerator do it. // of letting cmOSXBundleGenerator do it.
bool realname = target->IsFrameworkOnApple(); bool realname = gtgt->IsFrameworkOnApple();
switch (target->GetType()) { switch (target->GetType()) {
case cmState::EXECUTABLE: case cmState::EXECUTABLE:
@ -929,7 +931,6 @@ cmGlobalNinjaGenerator
case cmState::STATIC_LIBRARY: case cmState::STATIC_LIBRARY:
case cmState::MODULE_LIBRARY: case cmState::MODULE_LIBRARY:
{ {
cmGeneratorTarget *gtgt = this->GetGeneratorTarget(target);
outputs.push_back(this->ConvertToNinjaPath( outputs.push_back(this->ConvertToNinjaPath(
gtgt->GetFullPath(configName, false, realname))); gtgt->GetFullPath(configName, false, realname)));
break; break;

View File

@ -473,7 +473,7 @@ cmGlobalUnixMakefileGenerator3
(type == cmState::OBJECT_LIBRARY) || (type == cmState::OBJECT_LIBRARY) ||
(type == cmState::UTILITY)) (type == cmState::UTILITY))
{ {
if(gtarget->Target->IsImported()) if(gtarget->IsImported())
{ {
continue; continue;
} }
@ -632,7 +632,7 @@ cmGlobalUnixMakefileGenerator3
t != targets.end(); ++t) t != targets.end(); ++t)
{ {
cmGeneratorTarget* gtarget = t->second; cmGeneratorTarget* gtarget = t->second;
if(gtarget->Target->IsImported()) if(gtarget->IsImported())
{ {
continue; continue;
} }
@ -733,7 +733,7 @@ cmGlobalUnixMakefileGenerator3
t != targets.end(); ++t) t != targets.end(); ++t)
{ {
cmGeneratorTarget* gtarget = t->second; cmGeneratorTarget* gtarget = t->second;
if(gtarget->Target->IsImported()) if(gtarget->IsImported())
{ {
continue; continue;
} }

View File

@ -385,7 +385,7 @@ bool cmGlobalVisualStudioGenerator::ComputeTargetDepends()
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
static bool VSLinkable(cmTarget const* t) static bool VSLinkable(cmGeneratorTarget const* t)
{ {
return t->IsLinkable() || t->GetType() == cmState::OBJECT_LIBRARY; return t->IsLinkable() || t->GetType() == cmState::OBJECT_LIBRARY;
} }
@ -475,7 +475,8 @@ void cmGlobalVisualStudioGenerator::ComputeVSTargetDepends(cmTarget& target)
di != utilDepends.end(); ++di) di != utilDepends.end(); ++di)
{ {
cmTarget const* dep = *di; cmTarget const* dep = *di;
if(allowLinkable || !VSLinkable(dep) || linked.count(dep)) cmGeneratorTarget* dgt = this->GetGeneratorTarget(dep);
if(allowLinkable || !VSLinkable(dgt) || linked.count(dep))
{ {
// Direct dependency allowed. // Direct dependency allowed.
vsTargetDepend.insert(dep->GetName()); vsTargetDepend.insert(dep->GetName());

View File

@ -787,14 +787,16 @@ cmGlobalXCodeGenerator::CreateXCodeSourceFile(cmLocalGenerator* lg,
// Is this a resource file in this target? Add it to the resources group... // Is this a resource file in this target? Add it to the resources group...
// //
cmGeneratorTarget* gtgt = this->GetGeneratorTarget(&cmtarget);
cmGeneratorTarget::SourceFileFlags tsFlags = cmGeneratorTarget::SourceFileFlags tsFlags =
this->GetGeneratorTarget(&cmtarget)->GetTargetSourceFileFlags(sf); gtgt->GetTargetSourceFileFlags(sf);
bool isResource = tsFlags.Type == cmGeneratorTarget::SourceFileTypeResource; bool isResource = tsFlags.Type == cmGeneratorTarget::SourceFileTypeResource;
// Is this a "private" or "public" framework header file? // Is this a "private" or "public" framework header file?
// Set the ATTRIBUTES attribute appropriately... // Set the ATTRIBUTES attribute appropriately...
// //
if(cmtarget.IsFrameworkOnApple()) if(gtgt->IsFrameworkOnApple())
{ {
if(tsFlags.Type == cmGeneratorTarget::SourceFileTypePrivateHeader) if(tsFlags.Type == cmGeneratorTarget::SourceFileTypePrivateHeader)
{ {
@ -1193,9 +1195,9 @@ cmGlobalXCodeGenerator::CreateXCodeTargets(cmLocalGenerator* gen,
} }
// some build phases only apply to bundles and/or frameworks // some build phases only apply to bundles and/or frameworks
bool isFrameworkTarget = cmtarget.IsFrameworkOnApple(); bool isFrameworkTarget = gtgt->IsFrameworkOnApple();
bool isBundleTarget = cmtarget.GetPropertyAsBool("MACOSX_BUNDLE"); bool isBundleTarget = cmtarget.GetPropertyAsBool("MACOSX_BUNDLE");
bool isCFBundleTarget = cmtarget.IsCFBundleOnApple(); bool isCFBundleTarget = gtgt->IsCFBundleOnApple();
cmXCodeObject* buildFiles = 0; cmXCodeObject* buildFiles = 0;
@ -1289,7 +1291,7 @@ cmGlobalXCodeGenerator::CreateXCodeTargets(cmLocalGenerator* gen,
copyFilesBuildPhase->AddAttribute("dstSubfolderSpec", copyFilesBuildPhase->AddAttribute("dstSubfolderSpec",
this->CreateString("6")); this->CreateString("6"));
std::ostringstream ostr; std::ostringstream ostr;
if (cmtarget.IsFrameworkOnApple()) if (gtgt->IsFrameworkOnApple())
{ {
// dstPath in frameworks is relative to Versions/<version> // dstPath in frameworks is relative to Versions/<version>
ostr << mit->first; ostr << mit->first;
@ -1467,8 +1469,10 @@ void cmGlobalXCodeGenerator::CreateCustomCommands(cmXCodeObject* buildPhases,
std::vector<cmCustomCommand> postbuild std::vector<cmCustomCommand> postbuild
= cmtarget.GetPostBuildCommands(); = cmtarget.GetPostBuildCommands();
cmGeneratorTarget* gtgt = this->GetGeneratorTarget(&cmtarget);
if(cmtarget.GetType() == cmState::SHARED_LIBRARY && if(cmtarget.GetType() == cmState::SHARED_LIBRARY &&
!cmtarget.IsFrameworkOnApple()) !gtgt->IsFrameworkOnApple())
{ {
cmCustomCommandLines cmd; cmCustomCommandLines cmd;
cmd.resize(1); cmd.resize(1);
@ -1500,7 +1504,6 @@ void cmGlobalXCodeGenerator::CreateCustomCommands(cmXCodeObject* buildPhases,
} }
std::vector<cmSourceFile*> classes; std::vector<cmSourceFile*> classes;
cmGeneratorTarget* gtgt = this->GetGeneratorTarget(&cmtarget);
if (!gtgt->GetConfigCommonSourceFiles(classes)) if (!gtgt->GetConfigCommonSourceFiles(classes))
{ {
return; return;
@ -1814,14 +1817,14 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
this->CurrentLocalGenerator->AddLanguageFlags(flags, lang, configName); this->CurrentLocalGenerator->AddLanguageFlags(flags, lang, configName);
// Add shared-library flags if needed. // Add shared-library flags if needed.
this->CurrentLocalGenerator->AddCMP0018Flags(flags, &target, this->CurrentLocalGenerator->AddCMP0018Flags(flags, gtgt,
lang, configName); lang, configName);
this->CurrentLocalGenerator->AddVisibilityPresetFlags(flags, &target, this->CurrentLocalGenerator->AddVisibilityPresetFlags(flags, gtgt,
lang); lang);
this->CurrentLocalGenerator-> this->CurrentLocalGenerator->
AddCompileOptions(flags, &target, lang, configName); AddCompileOptions(flags, gtgt, lang, configName);
} }
std::string llang = gtgt->GetLinkerLanguage(configName); std::string llang = gtgt->GetLinkerLanguage(configName);
@ -1884,7 +1887,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
this->CurrentLocalGenerator this->CurrentLocalGenerator
->GetStaticLibraryFlags(extraLinkOptions, ->GetStaticLibraryFlags(extraLinkOptions,
cmSystemTools::UpperCase(configName), cmSystemTools::UpperCase(configName),
&target); gtgt);
} }
else else
{ {
@ -1943,7 +1946,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
const char* version = target.GetProperty("VERSION"); const char* version = target.GetProperty("VERSION");
const char* soversion = target.GetProperty("SOVERSION"); const char* soversion = target.GetProperty("SOVERSION");
if(!gtgt->HasSOName(configName) || target.IsFrameworkOnApple()) if(!gtgt->HasSOName(configName) || gtgt->IsFrameworkOnApple())
{ {
version = 0; version = 0;
soversion = 0; soversion = 0;
@ -1990,7 +1993,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
pndir = gtgt->GetDirectory(configName); pndir = gtgt->GetDirectory(configName);
} }
if(target.IsFrameworkOnApple() || target.IsCFBundleOnApple()) if(gtgt->IsFrameworkOnApple() || gtgt->IsCFBundleOnApple())
{ {
pnprefix = ""; pnprefix = "";
} }
@ -2043,7 +2046,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
{ {
buildSettings->AddAttribute("LIBRARY_STYLE", buildSettings->AddAttribute("LIBRARY_STYLE",
this->CreateString("BUNDLE")); this->CreateString("BUNDLE"));
if (target.IsCFBundleOnApple()) if (gtgt->IsCFBundleOnApple())
{ {
// It turns out that a BUNDLE is basically the same // It turns out that a BUNDLE is basically the same
// in many ways as an application bundle, as far as // in many ways as an application bundle, as far as
@ -2062,7 +2065,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
// a per-configuration Info.plist file. The cfbundle plist // a per-configuration Info.plist file. The cfbundle plist
// is very similar to the application bundle plist // is very similar to the application bundle plist
this->CurrentLocalGenerator this->CurrentLocalGenerator
->GenerateAppleInfoPList(&target, "$(EXECUTABLE_NAME)", ->GenerateAppleInfoPList(gtgt, "$(EXECUTABLE_NAME)",
plist.c_str()); plist.c_str());
std::string path = std::string path =
this->ConvertToRelativeForXCode(plist.c_str()); this->ConvertToRelativeForXCode(plist.c_str());
@ -2111,7 +2114,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
// so let it replace the framework name. This avoids creating // so let it replace the framework name. This avoids creating
// a per-configuration Info.plist file. // a per-configuration Info.plist file.
this->CurrentLocalGenerator this->CurrentLocalGenerator
->GenerateFrameworkInfoPList(&target, "$(EXECUTABLE_NAME)", ->GenerateFrameworkInfoPList(gtgt, "$(EXECUTABLE_NAME)",
plist.c_str()); plist.c_str());
std::string path = std::string path =
this->ConvertToRelativeForXCode(plist.c_str()); this->ConvertToRelativeForXCode(plist.c_str());
@ -2154,7 +2157,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
// so let it replace the executable name. This avoids creating // so let it replace the executable name. This avoids creating
// a per-configuration Info.plist file. // a per-configuration Info.plist file.
this->CurrentLocalGenerator this->CurrentLocalGenerator
->GenerateAppleInfoPList(&target, "$(EXECUTABLE_NAME)", ->GenerateAppleInfoPList(gtgt, "$(EXECUTABLE_NAME)",
plist.c_str()); plist.c_str());
std::string path = std::string path =
this->ConvertToRelativeForXCode(plist.c_str()); this->ConvertToRelativeForXCode(plist.c_str());
@ -2422,7 +2425,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
int patch; int patch;
// VERSION -> current_version // VERSION -> current_version
target.GetTargetVersion(false, major, minor, patch); gtgt->GetTargetVersion(false, major, minor, patch);
std::ostringstream v; std::ostringstream v;
// Xcode always wants at least 1.0.0 or nothing // Xcode always wants at least 1.0.0 or nothing
@ -2434,7 +2437,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
this->CreateString(v.str().c_str())); this->CreateString(v.str().c_str()));
// SOVERSION -> compatibility_version // SOVERSION -> compatibility_version
target.GetTargetVersion(true, major, minor, patch); gtgt->GetTargetVersion(true, major, minor, patch);
std::ostringstream vso; std::ostringstream vso;
// Xcode always wants at least 1.0.0 or nothing // Xcode always wants at least 1.0.0 or nothing
@ -2639,23 +2642,24 @@ cmGlobalXCodeGenerator::GetTargetLinkFlagsVar(cmTarget const& cmtarget) const
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
const char* cmGlobalXCodeGenerator::GetTargetFileType(cmTarget& cmtarget) const char* cmGlobalXCodeGenerator::GetTargetFileType(
cmGeneratorTarget* target)
{ {
switch(cmtarget.GetType()) switch(target->GetType())
{ {
case cmState::OBJECT_LIBRARY: case cmState::OBJECT_LIBRARY:
case cmState::STATIC_LIBRARY: case cmState::STATIC_LIBRARY:
return "archive.ar"; return "archive.ar";
case cmState::MODULE_LIBRARY: case cmState::MODULE_LIBRARY:
if (cmtarget.IsXCTestOnApple()) if (target->IsXCTestOnApple())
return "wrapper.cfbundle"; return "wrapper.cfbundle";
else if (cmtarget.IsCFBundleOnApple()) else if (target->IsCFBundleOnApple())
return "wrapper.plug-in"; return "wrapper.plug-in";
else else
return ((this->XcodeVersion >= 22)? return ((this->XcodeVersion >= 22)?
"compiled.mach-o.executable" : "compiled.mach-o.dylib"); "compiled.mach-o.executable" : "compiled.mach-o.dylib");
case cmState::SHARED_LIBRARY: case cmState::SHARED_LIBRARY:
return (cmtarget.GetPropertyAsBool("FRAMEWORK")? return (target->GetPropertyAsBool("FRAMEWORK")?
"wrapper.framework" : "compiled.mach-o.dylib"); "wrapper.framework" : "compiled.mach-o.dylib");
case cmState::EXECUTABLE: case cmState::EXECUTABLE:
return "compiled.mach-o.executable"; return "compiled.mach-o.executable";
@ -2665,28 +2669,29 @@ const char* cmGlobalXCodeGenerator::GetTargetFileType(cmTarget& cmtarget)
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
const char* cmGlobalXCodeGenerator::GetTargetProductType(cmTarget& cmtarget) const char* cmGlobalXCodeGenerator::GetTargetProductType(
cmGeneratorTarget* target)
{ {
switch(cmtarget.GetType()) switch(target->GetType())
{ {
case cmState::OBJECT_LIBRARY: case cmState::OBJECT_LIBRARY:
case cmState::STATIC_LIBRARY: case cmState::STATIC_LIBRARY:
return "com.apple.product-type.library.static"; return "com.apple.product-type.library.static";
case cmState::MODULE_LIBRARY: case cmState::MODULE_LIBRARY:
if (cmtarget.IsXCTestOnApple()) if (target->IsXCTestOnApple())
return "com.apple.product-type.bundle.unit-test"; return "com.apple.product-type.bundle.unit-test";
else if (cmtarget.IsCFBundleOnApple()) else if (target->IsCFBundleOnApple())
return "com.apple.product-type.bundle"; return "com.apple.product-type.bundle";
else else
return ((this->XcodeVersion >= 22)? return ((this->XcodeVersion >= 22)?
"com.apple.product-type.tool" : "com.apple.product-type.tool" :
"com.apple.product-type.library.dynamic"); "com.apple.product-type.library.dynamic");
case cmState::SHARED_LIBRARY: case cmState::SHARED_LIBRARY:
return (cmtarget.GetPropertyAsBool("FRAMEWORK")? return (target->GetPropertyAsBool("FRAMEWORK")?
"com.apple.product-type.framework" : "com.apple.product-type.framework" :
"com.apple.product-type.library.dynamic"); "com.apple.product-type.library.dynamic");
case cmState::EXECUTABLE: case cmState::EXECUTABLE:
return (cmtarget.GetPropertyAsBool("MACOSX_BUNDLE")? return (target->GetPropertyAsBool("MACOSX_BUNDLE")?
"com.apple.product-type.application" : "com.apple.product-type.application" :
"com.apple.product-type.tool"); "com.apple.product-type.tool");
default: break; default: break;
@ -2727,9 +2732,11 @@ cmGlobalXCodeGenerator::CreateXCodeTarget(cmTarget& cmtarget,
target->AddAttribute("name", this->CreateString(cmtarget.GetName())); target->AddAttribute("name", this->CreateString(cmtarget.GetName()));
target->AddAttribute("productName",this->CreateString(cmtarget.GetName())); target->AddAttribute("productName",this->CreateString(cmtarget.GetName()));
cmGeneratorTarget *gtgt = this->GetGeneratorTarget(&cmtarget);
cmXCodeObject* fileRef = cmXCodeObject* fileRef =
this->CreateObject(cmXCodeObject::PBXFileReference); this->CreateObject(cmXCodeObject::PBXFileReference);
if(const char* fileType = this->GetTargetFileType(cmtarget)) if(const char* fileType = this->GetTargetFileType(gtgt))
{ {
fileRef->AddAttribute("explicitFileType", this->CreateString(fileType)); fileRef->AddAttribute("explicitFileType", this->CreateString(fileType));
} }
@ -2742,7 +2749,6 @@ cmGlobalXCodeGenerator::CreateXCodeTarget(cmTarget& cmtarget,
} }
else else
{ {
cmGeneratorTarget *gtgt = this->GetGeneratorTarget(&cmtarget);
fullName = gtgt->GetFullName(defConfig.c_str()); fullName = gtgt->GetFullName(defConfig.c_str());
} }
fileRef->AddAttribute("path", this->CreateString(fullName.c_str())); fileRef->AddAttribute("path", this->CreateString(fullName.c_str()));
@ -2752,7 +2758,7 @@ cmGlobalXCodeGenerator::CreateXCodeTarget(cmTarget& cmtarget,
fileRef->SetComment(cmtarget.GetName().c_str()); fileRef->SetComment(cmtarget.GetName().c_str());
target->AddAttribute("productReference", target->AddAttribute("productReference",
this->CreateObjectReference(fileRef)); this->CreateObjectReference(fileRef));
if(const char* productType = this->GetTargetProductType(cmtarget)) if(const char* productType = this->GetTargetProductType(gtgt))
{ {
target->AddAttribute("productType", this->CreateString(productType)); target->AddAttribute("productType", this->CreateString(productType));
} }

View File

@ -137,8 +137,8 @@ private:
void ForceLinkerLanguages(); void ForceLinkerLanguages();
void ForceLinkerLanguage(cmTarget& cmtarget); void ForceLinkerLanguage(cmTarget& cmtarget);
const char* GetTargetLinkFlagsVar(cmTarget const& cmtarget) const; const char* GetTargetLinkFlagsVar(cmTarget const& cmtarget) const;
const char* GetTargetFileType(cmTarget& cmtarget); const char* GetTargetFileType(cmGeneratorTarget* target);
const char* GetTargetProductType(cmTarget& cmtarget); const char* GetTargetProductType(cmGeneratorTarget* target);
std::string AddConfigurations(cmXCodeObject* target, cmTarget& cmtarget); std::string AddConfigurations(cmXCodeObject* target, cmTarget& cmtarget);
void AppendOrAddBuildSetting(cmXCodeObject* settings, const char* attr, void AppendOrAddBuildSetting(cmXCodeObject* settings, const char* attr,
const char* value); const char* value);

View File

@ -126,7 +126,6 @@ bool cmIncludeCommand
} }
} }
gg->CreateGenerationObjects(); gg->CreateGenerationObjects();
gg->ComputeBuildFileGenerators();
gg->GenerateImportFile(fname_abs); gg->GenerateImportFile(fname_abs);
} }

View File

@ -773,7 +773,7 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args)
if(!exports.GetString().empty() && !namelinkOnly) if(!exports.GetString().empty() && !namelinkOnly)
{ {
cmTargetExport *te = new cmTargetExport; cmTargetExport *te = new cmTargetExport;
te->Target = &target; te->TargetName = target.GetName();
te->ArchiveGenerator = archiveGenerator; te->ArchiveGenerator = archiveGenerator;
te->BundleGenerator = bundleGenerator; te->BundleGenerator = bundleGenerator;
te->FrameworkGenerator = frameworkGenerator; te->FrameworkGenerator = frameworkGenerator;
@ -1379,16 +1379,17 @@ bool cmInstallCommand::HandleExportMode(std::vector<std::string> const& args)
tei != exportSet->GetTargetExports()->end(); ++tei) tei != exportSet->GetTargetExports()->end(); ++tei)
{ {
cmTargetExport const* te = *tei; cmTargetExport const* te = *tei;
cmTarget* tgt = this->Makefile->FindTarget(te->TargetName);
const bool newCMP0022Behavior = const bool newCMP0022Behavior =
te->Target->GetPolicyStatusCMP0022() != cmPolicies::WARN tgt->GetPolicyStatusCMP0022() != cmPolicies::WARN
&& te->Target->GetPolicyStatusCMP0022() != cmPolicies::OLD; && tgt->GetPolicyStatusCMP0022() != cmPolicies::OLD;
if(!newCMP0022Behavior) if(!newCMP0022Behavior)
{ {
std::ostringstream e; std::ostringstream e;
e << "INSTALL(EXPORT) given keyword \"" e << "INSTALL(EXPORT) given keyword \""
<< "EXPORT_LINK_INTERFACE_LIBRARIES" << "\", but target \"" << "EXPORT_LINK_INTERFACE_LIBRARIES" << "\", but target \""
<< te->Target->GetName() << te->TargetName
<< "\" does not have policy CMP0022 set to NEW."; << "\" does not have policy CMP0022 set to NEW.";
this->SetError(e.str()); this->SetError(e.str());
return false; return false;

View File

@ -56,6 +56,7 @@ cmInstallExportGenerator::~cmInstallExportGenerator()
void cmInstallExportGenerator::Compute(cmLocalGenerator* lg) void cmInstallExportGenerator::Compute(cmLocalGenerator* lg)
{ {
this->LocalGenerator = lg; this->LocalGenerator = lg;
this->ExportSet->Compute(lg);
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------

View File

@ -150,7 +150,7 @@ void cmInstallTargetGenerator::GenerateScriptForConfig(std::ostream& os,
std::string to1 = toDir + targetName; std::string to1 = toDir + targetName;
// Handle OSX Bundles. // Handle OSX Bundles.
if(this->Target->Target->IsAppBundleOnApple()) if(this->Target->IsAppBundleOnApple())
{ {
// Install the whole app bundle directory. // Install the whole app bundle directory.
type = cmInstallType_DIRECTORY; type = cmInstallType_DIRECTORY;
@ -208,7 +208,7 @@ void cmInstallTargetGenerator::GenerateScriptForConfig(std::ostream& os,
// An import library looks like a static library. // An import library looks like a static library.
type = cmInstallType_STATIC_LIBRARY; type = cmInstallType_STATIC_LIBRARY;
} }
else if(this->Target->Target->IsFrameworkOnApple()) else if(this->Target->IsFrameworkOnApple())
{ {
// There is a bug in cmInstallCommand if this fails. // There is a bug in cmInstallCommand if this fails.
assert(this->NamelinkMode == NamelinkModeNone); assert(this->NamelinkMode == NamelinkModeNone);
@ -226,7 +226,7 @@ void cmInstallTargetGenerator::GenerateScriptForConfig(std::ostream& os,
filesFrom.push_back(from1); filesFrom.push_back(from1);
filesTo.push_back(to1); filesTo.push_back(to1);
} }
else if(this->Target->Target->IsCFBundleOnApple()) else if(this->Target->IsCFBundleOnApple())
{ {
// Install the whole app bundle directory. // Install the whole app bundle directory.
type = cmInstallType_DIRECTORY; type = cmInstallType_DIRECTORY;
@ -359,34 +359,31 @@ cmInstallTargetGenerator::GetInstallFilename(const std::string& config) const
{ {
NameType nameType = this->ImportLibrary? NameImplib : NameNormal; NameType nameType = this->ImportLibrary? NameImplib : NameNormal;
return return
cmInstallTargetGenerator::GetInstallFilename(this->Target->Target, config, cmInstallTargetGenerator::GetInstallFilename(this->Target, config,
nameType); nameType);
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
std::string std::string
cmInstallTargetGenerator::GetInstallFilename(cmTarget const* target, cmInstallTargetGenerator::GetInstallFilename(cmGeneratorTarget const* target,
const std::string& config, const std::string& config,
NameType nameType) NameType nameType)
{ {
std::string fname; std::string fname;
// Compute the name of the library. // Compute the name of the library.
cmGeneratorTarget *gtgt = target->GetMakefile()
->GetGlobalGenerator()
->GetGeneratorTarget(target);
if(target->GetType() == cmState::EXECUTABLE) if(target->GetType() == cmState::EXECUTABLE)
{ {
std::string targetName; std::string targetName;
std::string targetNameReal; std::string targetNameReal;
std::string targetNameImport; std::string targetNameImport;
std::string targetNamePDB; std::string targetNamePDB;
gtgt->GetExecutableNames(targetName, targetNameReal, target->GetExecutableNames(targetName, targetNameReal,
targetNameImport, targetNamePDB, targetNameImport, targetNamePDB,
config); config);
if(nameType == NameImplib) if(nameType == NameImplib)
{ {
// Use the import library name. // Use the import library name.
if(!gtgt->GetImplibGNUtoMS(targetNameImport, fname, if(!target->GetImplibGNUtoMS(targetNameImport, fname,
"${CMAKE_IMPORT_LIBRARY_SUFFIX}")) "${CMAKE_IMPORT_LIBRARY_SUFFIX}"))
{ {
fname = targetNameImport; fname = targetNameImport;
@ -410,12 +407,12 @@ cmInstallTargetGenerator::GetInstallFilename(cmTarget const* target,
std::string targetNameReal; std::string targetNameReal;
std::string targetNameImport; std::string targetNameImport;
std::string targetNamePDB; std::string targetNamePDB;
gtgt->GetLibraryNames(targetName, targetNameSO, targetNameReal, target->GetLibraryNames(targetName, targetNameSO, targetNameReal,
targetNameImport, targetNamePDB, config); targetNameImport, targetNamePDB, config);
if(nameType == NameImplib) if(nameType == NameImplib)
{ {
// Use the import library name. // Use the import library name.
if(!gtgt->GetImplibGNUtoMS(targetNameImport, fname, if(!target->GetImplibGNUtoMS(targetNameImport, fname,
"${CMAKE_IMPORT_LIBRARY_SUFFIX}")) "${CMAKE_IMPORT_LIBRARY_SUFFIX}"))
{ {
fname = targetNameImport; fname = targetNameImport;
@ -585,7 +582,7 @@ cmInstallTargetGenerator
// The directory portions differ. Append the filename to // The directory portions differ. Append the filename to
// create the mapping. // create the mapping.
std::string fname = std::string fname =
this->GetInstallFilename(tgt->Target, config, NameSO); this->GetInstallFilename(tgt, config, NameSO);
// Map from the build-tree install_name. // Map from the build-tree install_name.
for_build += fname; for_build += fname;
@ -608,7 +605,7 @@ cmInstallTargetGenerator
std::string for_install = std::string for_install =
this->Target->GetInstallNameDirForInstallTree(); this->Target->GetInstallNameDirForInstallTree();
if(this->Target->Target->IsFrameworkOnApple() && for_install.empty()) if(this->Target->IsFrameworkOnApple() && for_install.empty())
{ {
// Frameworks seem to have an id corresponding to their own full // Frameworks seem to have an id corresponding to their own full
// path. // path.
@ -622,7 +619,7 @@ cmInstallTargetGenerator
{ {
// Prepare to refer to the install-tree install_name. // Prepare to refer to the install-tree install_name.
new_id = for_install; new_id = for_install;
new_id += this->GetInstallFilename(this->Target->Target, config, NameSO); new_id += this->GetInstallFilename(this->Target, config, NameSO);
} }
} }

View File

@ -14,7 +14,6 @@
#include "cmInstallGenerator.h" #include "cmInstallGenerator.h"
class cmTarget;
class cmGeneratorTarget; class cmGeneratorTarget;
/** \class cmInstallTargetGenerator /** \class cmInstallTargetGenerator
@ -54,7 +53,7 @@ public:
NameReal NameReal
}; };
static std::string GetInstallFilename(cmTarget const* target, static std::string GetInstallFilename(const cmGeneratorTarget* target,
const std::string& config, const std::string& config,
NameType nameType = NameNormal); NameType nameType = NameNormal);

View File

@ -476,7 +476,7 @@ void cmLocalGenerator::ComputeTargetManifest()
{ {
continue; continue;
} }
if (target.Target->IsImported()) if (target.IsImported())
{ {
continue; continue;
} }
@ -920,7 +920,7 @@ cmLocalGenerator::ExpandRuleVariables(std::string& s,
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
const char* cmLocalGenerator::GetRuleLauncher(cmTarget* target, const char* cmLocalGenerator::GetRuleLauncher(cmGeneratorTarget* target,
const std::string& prop) const std::string& prop)
{ {
if(target) if(target)
@ -934,7 +934,8 @@ const char* cmLocalGenerator::GetRuleLauncher(cmTarget* target,
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void cmLocalGenerator::InsertRuleLauncher(std::string& s, cmTarget* target, void cmLocalGenerator::InsertRuleLauncher(std::string& s,
cmGeneratorTarget* target,
const std::string& prop) const std::string& prop)
{ {
if(const char* val = this->GetRuleLauncher(target, prop)) if(const char* val = this->GetRuleLauncher(target, prop))
@ -1087,27 +1088,23 @@ std::string cmLocalGenerator::GetIncludeFlags(
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void cmLocalGenerator::AddCompileDefinitions(std::set<std::string>& defines, void cmLocalGenerator::AddCompileDefinitions(std::set<std::string>& defines,
cmTarget const* target, cmGeneratorTarget const* target,
const std::string& config, const std::string& config,
const std::string& lang) const std::string& lang)
{ {
std::vector<std::string> targetDefines; std::vector<std::string> targetDefines;
cmGeneratorTarget* gtgt = this->GlobalGenerator->GetGeneratorTarget(target); target->GetCompileDefinitions(targetDefines, config, lang);
gtgt->GetCompileDefinitions(targetDefines, config, lang);
this->AppendDefines(defines, targetDefines); this->AppendDefines(defines, targetDefines);
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void cmLocalGenerator::AddCompileOptions( void cmLocalGenerator::AddCompileOptions(
std::string& flags, cmTarget* target, std::string& flags, cmGeneratorTarget* target,
const std::string& lang, const std::string& config const std::string& lang, const std::string& config
) )
{ {
std::string langFlagRegexVar = std::string("CMAKE_")+lang+"_FLAG_REGEX"; std::string langFlagRegexVar = std::string("CMAKE_")+lang+"_FLAG_REGEX";
cmGeneratorTarget* gtgt =
this->GlobalGenerator->GetGeneratorTarget(target);
if(const char* langFlagRegexStr = if(const char* langFlagRegexStr =
this->Makefile->GetDefinition(langFlagRegexVar)) this->Makefile->GetDefinition(langFlagRegexVar))
{ {
@ -1118,7 +1115,7 @@ void cmLocalGenerator::AddCompileOptions(
{ {
cmSystemTools::ParseWindowsCommandLine(targetFlags, opts); cmSystemTools::ParseWindowsCommandLine(targetFlags, opts);
} }
gtgt->GetCompileOptions(opts, config, lang); target->GetCompileOptions(opts, config, lang);
for(std::vector<std::string>::const_iterator i = opts.begin(); for(std::vector<std::string>::const_iterator i = opts.begin();
i != opts.end(); ++i) i != opts.end(); ++i)
{ {
@ -1139,7 +1136,7 @@ void cmLocalGenerator::AddCompileOptions(
this->AppendFlags(flags, targetFlags); this->AppendFlags(flags, targetFlags);
} }
std::vector<std::string> opts; std::vector<std::string> opts;
gtgt->GetCompileOptions(opts, config, lang); target->GetCompileOptions(opts, config, lang);
for(std::vector<std::string>::const_iterator i = opts.begin(); for(std::vector<std::string>::const_iterator i = opts.begin();
i != opts.end(); ++i) i != opts.end(); ++i)
{ {
@ -1148,19 +1145,19 @@ void cmLocalGenerator::AddCompileOptions(
} }
} }
std::vector<std::string> features; std::vector<std::string> features;
gtgt->GetCompileFeatures(features, config); target->GetCompileFeatures(features, config);
for(std::vector<std::string>::const_iterator it = features.begin(); for(std::vector<std::string>::const_iterator it = features.begin();
it != features.end(); ++it) it != features.end(); ++it)
{ {
if (!this->Makefile->AddRequiredTargetFeature(target, *it)) if (!this->Makefile->AddRequiredTargetFeature(target->Target, *it))
{ {
return; return;
} }
} }
for(std::map<std::string, std::string>::const_iterator it for(std::map<std::string, std::string>::const_iterator it
= gtgt->GetMaxLanguageStandards().begin(); = target->GetMaxLanguageStandards().begin();
it != gtgt->GetMaxLanguageStandards().end(); ++it) it != target->GetMaxLanguageStandards().end(); ++it)
{ {
const char* standard = target->GetProperty(it->first + "_STANDARD"); const char* standard = target->GetProperty(it->first + "_STANDARD");
if(!standard) if(!standard)
@ -1314,7 +1311,7 @@ void cmLocalGenerator::GetIncludeDirectories(std::vector<std::string>& dirs,
void cmLocalGenerator::GetStaticLibraryFlags(std::string& flags, void cmLocalGenerator::GetStaticLibraryFlags(std::string& flags,
std::string const& config, std::string const& config,
cmTarget* target) cmGeneratorTarget* target)
{ {
this->AppendFlags(flags, this->AppendFlags(flags,
this->Makefile->GetSafeDefinition("CMAKE_STATIC_LINKER_FLAGS")); this->Makefile->GetSafeDefinition("CMAKE_STATIC_LINKER_FLAGS"));
@ -1348,7 +1345,7 @@ void cmLocalGenerator::GetTargetFlags(std::string& linkLibs,
switch(target->GetType()) switch(target->GetType())
{ {
case cmState::STATIC_LIBRARY: case cmState::STATIC_LIBRARY:
this->GetStaticLibraryFlags(linkFlags, buildType, target->Target); this->GetStaticLibraryFlags(linkFlags, buildType, target);
break; break;
case cmState::MODULE_LIBRARY: case cmState::MODULE_LIBRARY:
libraryLinkVariable = "CMAKE_MODULE_LINKER_FLAGS"; libraryLinkVariable = "CMAKE_MODULE_LINKER_FLAGS";
@ -1421,7 +1418,7 @@ void cmLocalGenerator::GetTargetFlags(std::string& linkLibs,
{ {
cmSystemTools::Error cmSystemTools::Error
("CMake can not determine linker language for target: ", ("CMake can not determine linker language for target: ",
target->Target->GetName().c_str()); target->GetName().c_str());
return; return;
} }
this->AddLanguageFlags(flags, linkLanguage, buildType); this->AddLanguageFlags(flags, linkLanguage, buildType);
@ -1904,7 +1901,8 @@ void cmLocalGenerator::AddSharedFlags(std::string& flags,
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void cmLocalGenerator:: void cmLocalGenerator::
AddCompilerRequirementFlag(std::string &flags, cmTarget const* target, AddCompilerRequirementFlag(std::string &flags,
cmGeneratorTarget const* target,
const std::string& lang) const std::string& lang)
{ {
if (lang.empty()) if (lang.empty())
@ -1942,7 +1940,8 @@ AddCompilerRequirementFlag(std::string &flags, cmTarget const* target,
"CMAKE_" + lang + standardProp "CMAKE_" + lang + standardProp
+ "_" + type + "_COMPILE_OPTION"; + "_" + type + "_COMPILE_OPTION";
const char *opt = target->GetMakefile()->GetDefinition(option_flag); const char *opt = target->Target->GetMakefile()
->GetDefinition(option_flag);
if (!opt) if (!opt)
{ {
std::ostringstream e; std::ostringstream e;
@ -1983,7 +1982,7 @@ AddCompilerRequirementFlag(std::string &flags, cmTarget const* target,
std::string e = std::string e =
lang + "_STANDARD is set to invalid value '" + standard + "'"; lang + "_STANDARD is set to invalid value '" + standard + "'";
this->GetGlobalGenerator()->GetCMakeInstance() this->GetGlobalGenerator()->GetCMakeInstance()
->IssueMessage(cmake::FATAL_ERROR, e, target->GetBacktrace()); ->IssueMessage(cmake::FATAL_ERROR, e, target->Target->GetBacktrace());
return; return;
} }
@ -2007,7 +2006,7 @@ AddCompilerRequirementFlag(std::string &flags, cmTarget const* target,
+ "_" + type + "_COMPILE_OPTION"; + "_" + type + "_COMPILE_OPTION";
const char *opt = const char *opt =
target->GetMakefile()->GetRequiredDefinition(option_flag); target->Target->GetMakefile()->GetRequiredDefinition(option_flag);
this->AppendFlagEscape(flags, opt); this->AppendFlagEscape(flags, opt);
return; return;
} }
@ -2018,7 +2017,8 @@ AddCompilerRequirementFlag(std::string &flags, cmTarget const* target,
"CMAKE_" + lang + *stdIt "CMAKE_" + lang + *stdIt
+ "_" + type + "_COMPILE_OPTION"; + "_" + type + "_COMPILE_OPTION";
if (const char *opt = target->GetMakefile()->GetDefinition(option_flag)) if (const char *opt = target->Target
->GetMakefile()->GetDefinition(option_flag))
{ {
this->AppendFlagEscape(flags, opt); this->AppendFlagEscape(flags, opt);
return; return;
@ -2094,7 +2094,7 @@ static void AddInlineVisibilityCompileOption(std::string &flags,
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void cmLocalGenerator void cmLocalGenerator
::AddVisibilityPresetFlags(std::string &flags, cmTarget const* target, ::AddVisibilityPresetFlags(std::string &flags, cmGeneratorTarget const* target,
const std::string& lang) const std::string& lang)
{ {
if (lang.empty()) if (lang.empty())
@ -2106,9 +2106,9 @@ void cmLocalGenerator
std::string *pWarnCMP0063 = 0; std::string *pWarnCMP0063 = 0;
if (target->GetType() != cmState::SHARED_LIBRARY && if (target->GetType() != cmState::SHARED_LIBRARY &&
target->GetType() != cmState::MODULE_LIBRARY && target->GetType() != cmState::MODULE_LIBRARY &&
!target->IsExecutableWithExports()) !target->Target->IsExecutableWithExports())
{ {
switch (target->GetPolicyStatusCMP0063()) switch (target->Target->GetPolicyStatusCMP0063())
{ {
case cmPolicies::OLD: case cmPolicies::OLD:
return; return;
@ -2120,11 +2120,12 @@ void cmLocalGenerator
} }
} }
AddVisibilityCompileOption(flags, target, this, lang, pWarnCMP0063); AddVisibilityCompileOption(flags, target->Target, this, lang, pWarnCMP0063);
if(lang == "CXX") if(lang == "CXX")
{ {
AddInlineVisibilityCompileOption(flags, target, this, pWarnCMP0063); AddInlineVisibilityCompileOption(flags, target->Target,
this, pWarnCMP0063);
} }
if (!warnCMP0063.empty() && if (!warnCMP0063.empty() &&
@ -2138,14 +2139,15 @@ void cmLocalGenerator
"has the following visibility properties set for " << lang << ":\n" << "has the following visibility properties set for " << lang << ":\n" <<
warnCMP0063 << warnCMP0063 <<
"For compatibility CMake is not honoring them for this target."; "For compatibility CMake is not honoring them for this target.";
target->GetMakefile()->GetCMakeInstance() target->Target->GetMakefile()->GetCMakeInstance()
->IssueMessage(cmake::AUTHOR_WARNING, w.str(), target->GetBacktrace()); ->IssueMessage(cmake::AUTHOR_WARNING, w.str(),
target->Target->GetBacktrace());
} }
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void cmLocalGenerator::AddCMP0018Flags(std::string &flags, void cmLocalGenerator::AddCMP0018Flags(std::string &flags,
cmTarget const* target, cmGeneratorTarget const* target,
std::string const& lang, std::string const& lang,
const std::string& config) const std::string& config)
{ {
@ -2169,9 +2171,7 @@ void cmLocalGenerator::AddCMP0018Flags(std::string &flags,
return; return;
} }
cmGeneratorTarget* gtgt = if (target->GetLinkInterfaceDependentBoolProperty(
this->GlobalGenerator->GetGeneratorTarget(target);
if (gtgt->GetLinkInterfaceDependentBoolProperty(
"POSITION_INDEPENDENT_CODE", "POSITION_INDEPENDENT_CODE",
config)) config))
{ {
@ -3012,7 +3012,7 @@ bool cmLocalGenerator::CheckDefinition(std::string const& define) const
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
static void cmLGInfoProp(cmMakefile* mf, cmTarget* target, static void cmLGInfoProp(cmMakefile* mf, cmGeneratorTarget* target,
const std::string& prop) const std::string& prop)
{ {
if(const char* val = target->GetProperty(prop)) if(const char* val = target->GetProperty(prop))
@ -3022,7 +3022,7 @@ static void cmLGInfoProp(cmMakefile* mf, cmTarget* target,
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void cmLocalGenerator::GenerateAppleInfoPList(cmTarget* target, void cmLocalGenerator::GenerateAppleInfoPList(cmGeneratorTarget* target,
const std::string& targetName, const std::string& targetName,
const char* fname) const char* fname)
{ {
@ -3066,7 +3066,7 @@ void cmLocalGenerator::GenerateAppleInfoPList(cmTarget* target,
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void cmLocalGenerator::GenerateFrameworkInfoPList(cmTarget* target, void cmLocalGenerator::GenerateFrameworkInfoPList(cmGeneratorTarget* target,
const std::string& targetName, const std::string& targetName,
const char* fname) const char* fname)
{ {

View File

@ -20,7 +20,6 @@
class cmMakefile; class cmMakefile;
class cmGlobalGenerator; class cmGlobalGenerator;
class cmGeneratorTarget; class cmGeneratorTarget;
class cmTarget;
class cmTargetManifest; class cmTargetManifest;
class cmSourceFile; class cmSourceFile;
class cmCustomCommand; class cmCustomCommand;
@ -91,13 +90,15 @@ public:
void AddLanguageFlags(std::string& flags, const std::string& lang, void AddLanguageFlags(std::string& flags, const std::string& lang,
const std::string& config); const std::string& config);
void AddCMP0018Flags(std::string &flags, cmTarget const* target, void AddCMP0018Flags(std::string &flags, cmGeneratorTarget const* target,
std::string const& lang, const std::string& config); std::string const& lang, const std::string& config);
void AddVisibilityPresetFlags(std::string &flags, cmTarget const* target, void AddVisibilityPresetFlags(std::string &flags,
cmGeneratorTarget const* target,
const std::string& lang); const std::string& lang);
void AddConfigVariableFlags(std::string& flags, const std::string& var, void AddConfigVariableFlags(std::string& flags, const std::string& var,
const std::string& config); const std::string& config);
void AddCompilerRequirementFlag(std::string &flags, cmTarget const* target, void AddCompilerRequirementFlag(std::string &flags,
cmGeneratorTarget const* target,
const std::string& lang); const std::string& lang);
///! Append flags to a string. ///! Append flags to a string.
virtual void AppendFlags(std::string& flags, const std::string& newFlags); virtual void AppendFlags(std::string& flags, const std::string& newFlags);
@ -188,10 +189,10 @@ public:
const std::string& lang = "C", const std::string& lang = "C",
const std::string& config = "", const std::string& config = "",
bool stripImplicitInclDirs = true) const; bool stripImplicitInclDirs = true) const;
void AddCompileOptions(std::string& flags, cmTarget* target, void AddCompileOptions(std::string& flags, cmGeneratorTarget* target,
const std::string& lang, const std::string& config); const std::string& lang, const std::string& config);
void AddCompileDefinitions(std::set<std::string>& defines, void AddCompileDefinitions(std::set<std::string>& defines,
cmTarget const* target, cmGeneratorTarget const* target,
const std::string& config, const std::string& config,
const std::string& lang); const std::string& lang);
@ -212,7 +213,7 @@ public:
{ {
memset(this, 0, sizeof(*this)); memset(this, 0, sizeof(*this));
} }
cmTarget* CMTarget; cmGeneratorTarget* CMTarget;
const char* TargetPDB; const char* TargetPDB;
const char* TargetCompilePDB; const char* TargetCompilePDB;
const char* TargetVersionMajor; const char* TargetVersionMajor;
@ -278,13 +279,14 @@ public:
/** /**
* Generate a Mac OS X application bundle Info.plist file. * Generate a Mac OS X application bundle Info.plist file.
*/ */
void GenerateAppleInfoPList(cmTarget* target, const std::string& targetName, void GenerateAppleInfoPList(cmGeneratorTarget* target,
const std::string& targetName,
const char* fname); const char* fname);
/** /**
* Generate a Mac OS X framework Info.plist file. * Generate a Mac OS X framework Info.plist file.
*/ */
void GenerateFrameworkInfoPList(cmTarget* target, void GenerateFrameworkInfoPList(cmGeneratorTarget* target,
const std::string& targetName, const std::string& targetName,
const char* fname); const char* fname);
/** Construct a comment for a custom command. */ /** Construct a comment for a custom command. */
@ -298,7 +300,7 @@ public:
/** Fill out the static linker flags for the given target. */ /** Fill out the static linker flags for the given target. */
void GetStaticLibraryFlags(std::string& flags, void GetStaticLibraryFlags(std::string& flags,
std::string const& config, std::string const& config,
cmTarget* target); cmGeneratorTarget* target);
/** Fill out these strings for the given target. Libraries to link, /** Fill out these strings for the given target. Libraries to link,
* flags, and linkflags. */ * flags, and linkflags. */
@ -341,8 +343,9 @@ protected:
std::string ExpandRuleVariable(std::string const& variable, std::string ExpandRuleVariable(std::string const& variable,
const RuleVariables& replaceValues); const RuleVariables& replaceValues);
const char* GetRuleLauncher(cmTarget* target, const std::string& prop); const char* GetRuleLauncher(cmGeneratorTarget* target,
void InsertRuleLauncher(std::string& s, cmTarget* target, const std::string& prop);
void InsertRuleLauncher(std::string& s, cmGeneratorTarget* target,
const std::string& prop); const std::string& prop);
// Handle old-style install rules stored in the targets. // Handle old-style install rules stored in the targets.
@ -367,7 +370,7 @@ protected:
std::string::size_type ObjectPathMax; std::string::size_type ObjectPathMax;
std::set<std::string> ObjectMaxPathViolations; std::set<std::string> ObjectMaxPathViolations;
std::set<cmTarget const*> WarnCMP0063; std::set<cmGeneratorTarget const*> WarnCMP0063;
cmGeneratorTargetsType GeneratorTargets; cmGeneratorTargetsType GeneratorTargets;
bool EmitUniversalBinaryFlags; bool EmitUniversalBinaryFlags;

View File

@ -32,7 +32,7 @@ void cmLocalGhsMultiGenerator::Generate()
++l) ++l)
{ {
if (l->second->GetType() == cmState::INTERFACE_LIBRARY if (l->second->GetType() == cmState::INTERFACE_LIBRARY
|| l->second->Target->IsImported()) || l->second->IsImported())
{ {
continue; continue;
} }

View File

@ -1034,7 +1034,7 @@ void
cmLocalUnixMakefileGenerator3 cmLocalUnixMakefileGenerator3
::AppendCustomCommands(std::vector<std::string>& commands, ::AppendCustomCommands(std::vector<std::string>& commands,
const std::vector<cmCustomCommand>& ccs, const std::vector<cmCustomCommand>& ccs,
cmTarget* target, cmGeneratorTarget* target,
cmLocalGenerator::RelativeRoot relative) cmLocalGenerator::RelativeRoot relative)
{ {
for(std::vector<cmCustomCommand>::const_iterator i = ccs.begin(); for(std::vector<cmCustomCommand>::const_iterator i = ccs.begin();
@ -1050,7 +1050,7 @@ void
cmLocalUnixMakefileGenerator3 cmLocalUnixMakefileGenerator3
::AppendCustomCommand(std::vector<std::string>& commands, ::AppendCustomCommand(std::vector<std::string>& commands,
cmCustomCommandGenerator const& ccg, cmCustomCommandGenerator const& ccg,
cmTarget* target, cmGeneratorTarget* target,
bool echo_comment, bool echo_comment,
cmLocalGenerator::RelativeRoot relative, cmLocalGenerator::RelativeRoot relative,
std::ostream* content) std::ostream* content)
@ -1181,7 +1181,7 @@ cmLocalUnixMakefileGenerator3
std::string std::string
cmLocalUnixMakefileGenerator3::MakeLauncher( cmLocalUnixMakefileGenerator3::MakeLauncher(
cmCustomCommandGenerator const& ccg, cmCustomCommandGenerator const& ccg,
cmTarget* target, RelativeRoot relative) cmGeneratorTarget* target, RelativeRoot relative)
{ {
// Short-circuit if there is no launcher. // Short-circuit if there is no launcher.
const char* prop = "RULE_LAUNCH_CUSTOM"; const char* prop = "RULE_LAUNCH_CUSTOM";
@ -1788,6 +1788,9 @@ void cmLocalUnixMakefileGenerator3
this->AppendEcho(commands, text, this->AppendEcho(commands, text,
cmLocalUnixMakefileGenerator3::EchoGlobal); cmLocalUnixMakefileGenerator3::EchoGlobal);
cmGeneratorTarget* gt = this->GlobalGenerator
->GetGeneratorTarget(&glIt->second);
// Global targets store their rules in pre- and post-build commands. // Global targets store their rules in pre- and post-build commands.
this->AppendCustomDepends(depends, this->AppendCustomDepends(depends,
glIt->second.GetPreBuildCommands()); glIt->second.GetPreBuildCommands());
@ -1795,11 +1798,11 @@ void cmLocalUnixMakefileGenerator3
glIt->second.GetPostBuildCommands()); glIt->second.GetPostBuildCommands());
this->AppendCustomCommands(commands, this->AppendCustomCommands(commands,
glIt->second.GetPreBuildCommands(), glIt->second.GetPreBuildCommands(),
&glIt->second, gt,
cmLocalGenerator::START_OUTPUT); cmLocalGenerator::START_OUTPUT);
this->AppendCustomCommands(commands, this->AppendCustomCommands(commands,
glIt->second.GetPostBuildCommands(), glIt->second.GetPostBuildCommands(),
&glIt->second, gt,
cmLocalGenerator::START_OUTPUT); cmLocalGenerator::START_OUTPUT);
std::string targetName = glIt->second.GetName(); std::string targetName = glIt->second.GetName();
this->WriteMakeRule(ruleFileStream, targetString.c_str(), this->WriteMakeRule(ruleFileStream, targetString.c_str(),
@ -1976,10 +1979,11 @@ void cmLocalUnixMakefileGenerator3::ClearDependencies(cmMakefile* mf,
void cmLocalUnixMakefileGenerator3 void cmLocalUnixMakefileGenerator3
::WriteDependLanguageInfo(std::ostream& cmakefileStream, cmTarget &target) ::WriteDependLanguageInfo(std::ostream& cmakefileStream,
cmGeneratorTarget* target)
{ {
ImplicitDependLanguageMap const& implicitLangs = ImplicitDependLanguageMap const& implicitLangs =
this->GetImplicitDepends(target); this->GetImplicitDepends(*target->Target);
// list the languages // list the languages
cmakefileStream cmakefileStream
@ -2030,7 +2034,7 @@ void cmLocalUnixMakefileGenerator3
// Build a list of preprocessor definitions for the target. // Build a list of preprocessor definitions for the target.
std::set<std::string> defines; std::set<std::string> defines;
this->AddCompileDefinitions(defines, &target, this->AddCompileDefinitions(defines, target,
this->ConfigName, l->first); this->ConfigName, l->first);
if(!defines.empty()) if(!defines.empty())
{ {
@ -2056,12 +2060,10 @@ void cmLocalUnixMakefileGenerator3
<< "set(CMAKE_" << l->first << "_TARGET_INCLUDE_PATH\n"; << "set(CMAKE_" << l->first << "_TARGET_INCLUDE_PATH\n";
std::vector<std::string> includes; std::vector<std::string> includes;
cmGeneratorTarget* gt = this->GetGlobalGenerator()
->GetGeneratorTarget(&target);
const std::string& config = const std::string& config =
this->Makefile->GetSafeDefinition("CMAKE_BUILD_TYPE"); this->Makefile->GetSafeDefinition("CMAKE_BUILD_TYPE");
this->GetIncludeDirectories(includes, gt, this->GetIncludeDirectories(includes, target,
l->first, config); l->first, config);
for(std::vector<std::string>::iterator i = includes.begin(); for(std::vector<std::string>::iterator i = includes.begin();
i != includes.end(); ++i) i != includes.end(); ++i)
@ -2084,7 +2086,7 @@ void cmLocalUnixMakefileGenerator3
cmSystemTools::ExpandListArgument(xform, transformRules); cmSystemTools::ExpandListArgument(xform, transformRules);
} }
if(const char* xform = if(const char* xform =
target.GetProperty("IMPLICIT_DEPENDS_INCLUDE_TRANSFORM")) target->GetProperty("IMPLICIT_DEPENDS_INCLUDE_TRANSFORM"))
{ {
cmSystemTools::ExpandListArgument(xform, transformRules); cmSystemTools::ExpandListArgument(xform, transformRules);
} }

View File

@ -182,7 +182,8 @@ protected:
// write the depend info // write the depend info
void WriteDependLanguageInfo(std::ostream& cmakefileStream, cmTarget &tgt); void WriteDependLanguageInfo(std::ostream& cmakefileStream,
cmGeneratorTarget *tgt);
// write the local help rule // write the local help rule
void WriteHelpRule(std::ostream& ruleFileStream); void WriteHelpRule(std::ostream& ruleFileStream);
@ -215,12 +216,12 @@ protected:
cmCustomCommandGenerator const& cc); cmCustomCommandGenerator const& cc);
void AppendCustomCommands(std::vector<std::string>& commands, void AppendCustomCommands(std::vector<std::string>& commands,
const std::vector<cmCustomCommand>& ccs, const std::vector<cmCustomCommand>& ccs,
cmTarget* target, cmGeneratorTarget* target,
cmLocalGenerator::RelativeRoot relative = cmLocalGenerator::RelativeRoot relative =
cmLocalGenerator::HOME_OUTPUT); cmLocalGenerator::HOME_OUTPUT);
void AppendCustomCommand(std::vector<std::string>& commands, void AppendCustomCommand(std::vector<std::string>& commands,
cmCustomCommandGenerator const& ccg, cmCustomCommandGenerator const& ccg,
cmTarget* target, cmGeneratorTarget* target,
bool echo_comment=false, bool echo_comment=false,
cmLocalGenerator::RelativeRoot relative = cmLocalGenerator::RelativeRoot relative =
cmLocalGenerator::HOME_OUTPUT, cmLocalGenerator::HOME_OUTPUT,
@ -237,7 +238,7 @@ protected:
private: private:
std::string ConvertShellCommand(std::string const& cmd, RelativeRoot root); std::string ConvertShellCommand(std::string const& cmd, RelativeRoot root);
std::string MakeLauncher(cmCustomCommandGenerator const& ccg, std::string MakeLauncher(cmCustomCommandGenerator const& ccg,
cmTarget* target, RelativeRoot relative); cmGeneratorTarget* target, RelativeRoot relative);
virtual void ComputeObjectFilenames( virtual void ComputeObjectFilenames(
std::map<cmSourceFile const*, std::string>& mapping, std::map<cmSourceFile const*, std::string>& mapping,

View File

@ -1319,7 +1319,7 @@ void cmLocalVisualStudio6Generator
{ {
int major; int major;
int minor; int minor;
target.GetTargetVersion(major, minor); gt->GetTargetVersion(major, minor);
std::ostringstream targetVersionStream; std::ostringstream targetVersionStream;
targetVersionStream << "/version:" << major << "." << minor; targetVersionStream << "/version:" << major << "." << minor;
targetVersionFlag = targetVersionStream.str(); targetVersionFlag = targetVersionStream.str();
@ -1750,12 +1750,12 @@ void cmLocalVisualStudio6Generator
flagsRelWithDebInfo = this->Makefile->GetSafeDefinition(flagVar.c_str()); flagsRelWithDebInfo = this->Makefile->GetSafeDefinition(flagVar.c_str());
flagsRelWithDebInfo += " -DCMAKE_INTDIR=\\\"RelWithDebInfo\\\" "; flagsRelWithDebInfo += " -DCMAKE_INTDIR=\\\"RelWithDebInfo\\\" ";
this->AddCompileOptions(flags, &target, linkLanguage, ""); this->AddCompileOptions(flags, gt, linkLanguage, "");
this->AddCompileOptions(flagsDebug, &target, linkLanguage, "Debug"); this->AddCompileOptions(flagsDebug, gt, linkLanguage, "Debug");
this->AddCompileOptions(flagsRelease, &target, linkLanguage, "Release"); this->AddCompileOptions(flagsRelease, gt, linkLanguage, "Release");
this->AddCompileOptions(flagsMinSizeRel, &target, linkLanguage, this->AddCompileOptions(flagsMinSizeRel, gt, linkLanguage,
"MinSizeRel"); "MinSizeRel");
this->AddCompileOptions(flagsRelWithDebInfo, &target, linkLanguage, this->AddCompileOptions(flagsRelWithDebInfo, gt, linkLanguage,
"RelWithDebInfo"); "RelWithDebInfo");
// if _UNICODE and _SBCS are not found, then add -D_MBCS // if _UNICODE and _SBCS are not found, then add -D_MBCS
@ -1775,14 +1775,14 @@ void cmLocalVisualStudio6Generator
std::set<std::string> minsizeDefinesSet; std::set<std::string> minsizeDefinesSet;
std::set<std::string> debugrelDefinesSet; std::set<std::string> debugrelDefinesSet;
this->AddCompileDefinitions(definesSet, &target, "", linkLanguage); this->AddCompileDefinitions(definesSet, gt, "", linkLanguage);
this->AddCompileDefinitions(debugDefinesSet, &target, this->AddCompileDefinitions(debugDefinesSet, gt,
"DEBUG", linkLanguage); "DEBUG", linkLanguage);
this->AddCompileDefinitions(releaseDefinesSet, &target, this->AddCompileDefinitions(releaseDefinesSet, gt,
"RELEASE", linkLanguage); "RELEASE", linkLanguage);
this->AddCompileDefinitions(minsizeDefinesSet, &target, this->AddCompileDefinitions(minsizeDefinesSet, gt,
"MINSIZEREL", linkLanguage); "MINSIZEREL", linkLanguage);
this->AddCompileDefinitions(debugrelDefinesSet, &target, this->AddCompileDefinitions(debugrelDefinesSet, gt,
"RELWITHDEBINFO", linkLanguage); "RELWITHDEBINFO", linkLanguage);
std::string defines = " "; std::string defines = " ";

View File

@ -733,7 +733,7 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout,
} }
// Add the target-specific flags. // Add the target-specific flags.
this->AddCompileOptions(flags, &target, linkLanguage, configName); this->AddCompileOptions(flags, gt, linkLanguage, configName);
} }
if(this->FortranProject) if(this->FortranProject)
@ -1152,7 +1152,7 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout,
} }
} }
std::string libflags; std::string libflags;
this->GetStaticLibraryFlags(libflags, configTypeUpper, &target); this->GetStaticLibraryFlags(libflags, configTypeUpper, gt);
if(!libflags.empty()) if(!libflags.empty())
{ {
fout << "\t\t\t\tAdditionalOptions=\"" << libflags << "\"\n"; fout << "\t\t\t\tAdditionalOptions=\"" << libflags << "\"\n";
@ -1215,7 +1215,7 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout,
temp += targetNameFull; temp += targetNameFull;
fout << "\t\t\t\tOutputFile=\"" fout << "\t\t\t\tOutputFile=\""
<< this->ConvertToXMLOutputPathSingle(temp.c_str()) << "\"\n"; << this->ConvertToXMLOutputPathSingle(temp.c_str()) << "\"\n";
this->WriteTargetVersionAttribute(fout, target); this->WriteTargetVersionAttribute(fout, gt);
linkOptions.OutputFlagMap(fout, "\t\t\t\t"); linkOptions.OutputFlagMap(fout, "\t\t\t\t");
fout << "\t\t\t\tAdditionalLibraryDirectories=\""; fout << "\t\t\t\tAdditionalLibraryDirectories=\"";
this->OutputLibraryDirectories(fout, cli.GetDirectories()); this->OutputLibraryDirectories(fout, cli.GetDirectories());
@ -1314,7 +1314,7 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout,
temp += targetNameFull; temp += targetNameFull;
fout << "\t\t\t\tOutputFile=\"" fout << "\t\t\t\tOutputFile=\""
<< this->ConvertToXMLOutputPathSingle(temp.c_str()) << "\"\n"; << this->ConvertToXMLOutputPathSingle(temp.c_str()) << "\"\n";
this->WriteTargetVersionAttribute(fout, target); this->WriteTargetVersionAttribute(fout, gt);
linkOptions.OutputFlagMap(fout, "\t\t\t\t"); linkOptions.OutputFlagMap(fout, "\t\t\t\t");
fout << "\t\t\t\tAdditionalLibraryDirectories=\""; fout << "\t\t\t\tAdditionalLibraryDirectories=\"";
this->OutputLibraryDirectories(fout, cli.GetDirectories()); this->OutputLibraryDirectories(fout, cli.GetDirectories());
@ -1384,11 +1384,11 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout,
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void void
cmLocalVisualStudio7Generator cmLocalVisualStudio7Generator
::WriteTargetVersionAttribute(std::ostream& fout, cmTarget& target) ::WriteTargetVersionAttribute(std::ostream& fout, cmGeneratorTarget* gt)
{ {
int major; int major;
int minor; int minor;
target.GetTargetVersion(major, minor); gt->GetTargetVersion(major, minor);
fout << "\t\t\t\tVersion=\"" << major << "." << minor << "\"\n"; fout << "\t\t\t\tVersion=\"" << major << "." << minor << "\"\n";
} }

View File

@ -106,7 +106,8 @@ private:
const char* source, const char* source,
const cmCustomCommand& command, const cmCustomCommand& command,
FCInfo& fcinfo); FCInfo& fcinfo);
void WriteTargetVersionAttribute(std::ostream& fout, cmTarget& target); void WriteTargetVersionAttribute(std::ostream& fout,
cmGeneratorTarget* gt);
bool WriteGroup(const cmSourceGroup *sg, bool WriteGroup(const cmSourceGroup *sg,
cmTarget& target, std::ostream &fout, cmTarget& target, std::ostream &fout,

View File

@ -100,7 +100,7 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
// Construct the full path version of the names. // Construct the full path version of the names.
std::string outpath = this->GeneratorTarget->GetDirectory(this->ConfigName); std::string outpath = this->GeneratorTarget->GetDirectory(this->ConfigName);
if(this->Target->IsAppBundleOnApple()) if(this->GeneratorTarget->IsAppBundleOnApple())
{ {
this->OSXBundleGenerator->CreateAppBundle(targetName, outpath); this->OSXBundleGenerator->CreateAppBundle(targetName, outpath);
} }
@ -168,7 +168,7 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
if(linkLanguage.empty()) if(linkLanguage.empty())
{ {
cmSystemTools::Error("Cannot determine link language for target \"", cmSystemTools::Error("Cannot determine link language for target \"",
this->Target->GetName().c_str(), "\"."); this->GeneratorTarget->GetName().c_str(), "\".");
return; return;
} }
@ -197,7 +197,7 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
this->ConfigName); this->ConfigName);
if(this->Target->GetPropertyAsBool("WIN32_EXECUTABLE")) if(this->GeneratorTarget->GetPropertyAsBool("WIN32_EXECUTABLE"))
{ {
this->LocalGenerator->AppendFlags this->LocalGenerator->AppendFlags
(linkFlags, this->Makefile->GetDefinition("CMAKE_CREATE_WIN32_EXE")); (linkFlags, this->Makefile->GetDefinition("CMAKE_CREATE_WIN32_EXE"));
@ -226,11 +226,11 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
// Add target-specific linker flags. // Add target-specific linker flags.
this->LocalGenerator->AppendFlags this->LocalGenerator->AppendFlags
(linkFlags, this->Target->GetProperty("LINK_FLAGS")); (linkFlags, this->GeneratorTarget->GetProperty("LINK_FLAGS"));
std::string linkFlagsConfig = "LINK_FLAGS_"; std::string linkFlagsConfig = "LINK_FLAGS_";
linkFlagsConfig += cmSystemTools::UpperCase(this->ConfigName); linkFlagsConfig += cmSystemTools::UpperCase(this->ConfigName);
this->LocalGenerator->AppendFlags this->LocalGenerator->AppendFlags
(linkFlags, this->Target->GetProperty(linkFlagsConfig)); (linkFlags, this->GeneratorTarget->GetProperty(linkFlagsConfig));
this->AddModuleDefinitionFlag(linkFlags); this->AddModuleDefinitionFlag(linkFlags);
@ -280,10 +280,10 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
{ {
this->LocalGenerator this->LocalGenerator
->AppendCustomCommands(commands, this->Target->GetPreBuildCommands(), ->AppendCustomCommands(commands, this->Target->GetPreBuildCommands(),
this->Target); this->GeneratorTarget);
this->LocalGenerator this->LocalGenerator
->AppendCustomCommands(commands, this->Target->GetPreLinkCommands(), ->AppendCustomCommands(commands, this->Target->GetPreLinkCommands(),
this->Target); this->GeneratorTarget);
} }
// Determine whether a link script will be used. // Determine whether a link script will be used.
@ -358,7 +358,7 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
cmLocalGenerator::RuleVariables vars; cmLocalGenerator::RuleVariables vars;
vars.RuleLauncher = "RULE_LAUNCH_LINK"; vars.RuleLauncher = "RULE_LAUNCH_LINK";
vars.CMTarget = this->Target; vars.CMTarget = this->GeneratorTarget;
vars.Language = linkLanguage.c_str(); vars.Language = linkLanguage.c_str();
vars.Objects = buildObjs.c_str(); vars.Objects = buildObjs.c_str();
std::string objectDir = this->GeneratorTarget->GetSupportDirectory(); std::string objectDir = this->GeneratorTarget->GetSupportDirectory();
@ -382,7 +382,7 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
std::ostringstream minorStream; std::ostringstream minorStream;
int major; int major;
int minor; int minor;
this->Target->GetTargetVersion(major, minor); this->GeneratorTarget->GetTargetVersion(major, minor);
majorStream << major; majorStream << major;
minorStream << minor; minorStream << minor;
targetVersionMajor = majorStream.str(); targetVersionMajor = majorStream.str();
@ -449,7 +449,7 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
{ {
this->LocalGenerator-> this->LocalGenerator->
AppendCustomCommands(commands, this->Target->GetPostBuildCommands(), AppendCustomCommands(commands, this->Target->GetPostBuildCommands(),
this->Target); this->GeneratorTarget);
} }
// Write the build rule. // Write the build rule.

View File

@ -115,18 +115,18 @@ void cmMakefileLibraryTargetGenerator::WriteObjectLibraryRules()
// Add post-build rules. // Add post-build rules.
this->LocalGenerator-> this->LocalGenerator->
AppendCustomCommands(commands, this->Target->GetPostBuildCommands(), AppendCustomCommands(commands, this->Target->GetPostBuildCommands(),
this->Target); this->GeneratorTarget);
// Depend on the object files. // Depend on the object files.
this->AppendObjectDepends(depends); this->AppendObjectDepends(depends);
// Write the rule. // Write the rule.
this->LocalGenerator->WriteMakeRule(*this->BuildFileStream, 0, this->LocalGenerator->WriteMakeRule(*this->BuildFileStream, 0,
this->Target->GetName(), this->GeneratorTarget->GetName(),
depends, commands, true); depends, commands, true);
// Write the main driver rule to build everything in this target. // Write the main driver rule to build everything in this target.
this->WriteTargetDriverRule(this->Target->GetName(), false); this->WriteTargetDriverRule(this->GeneratorTarget->GetName(), false);
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
@ -146,14 +146,14 @@ void cmMakefileLibraryTargetGenerator::WriteStaticLibraryRules()
std::string extraFlags; std::string extraFlags;
this->LocalGenerator->GetStaticLibraryFlags(extraFlags, this->LocalGenerator->GetStaticLibraryFlags(extraFlags,
cmSystemTools::UpperCase(this->ConfigName), this->Target); cmSystemTools::UpperCase(this->ConfigName), this->GeneratorTarget);
this->WriteLibraryRules(linkRuleVar, extraFlags, false); this->WriteLibraryRules(linkRuleVar, extraFlags, false);
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void cmMakefileLibraryTargetGenerator::WriteSharedLibraryRules(bool relink) void cmMakefileLibraryTargetGenerator::WriteSharedLibraryRules(bool relink)
{ {
if(this->Target->IsFrameworkOnApple()) if(this->GeneratorTarget->IsFrameworkOnApple())
{ {
this->WriteFrameworkRules(relink); this->WriteFrameworkRules(relink);
return; return;
@ -166,11 +166,11 @@ void cmMakefileLibraryTargetGenerator::WriteSharedLibraryRules(bool relink)
std::string extraFlags; std::string extraFlags;
this->LocalGenerator->AppendFlags this->LocalGenerator->AppendFlags
(extraFlags, this->Target->GetProperty("LINK_FLAGS")); (extraFlags, this->GeneratorTarget->GetProperty("LINK_FLAGS"));
std::string linkFlagsConfig = "LINK_FLAGS_"; std::string linkFlagsConfig = "LINK_FLAGS_";
linkFlagsConfig += cmSystemTools::UpperCase(this->ConfigName); linkFlagsConfig += cmSystemTools::UpperCase(this->ConfigName);
this->LocalGenerator->AppendFlags this->LocalGenerator->AppendFlags
(extraFlags, this->Target->GetProperty(linkFlagsConfig)); (extraFlags, this->GeneratorTarget->GetProperty(linkFlagsConfig));
this->LocalGenerator->AddConfigVariableFlags this->LocalGenerator->AddConfigVariableFlags
(extraFlags, "CMAKE_SHARED_LINKER_FLAGS", this->ConfigName); (extraFlags, "CMAKE_SHARED_LINKER_FLAGS", this->ConfigName);
@ -190,11 +190,11 @@ void cmMakefileLibraryTargetGenerator::WriteModuleLibraryRules(bool relink)
std::string extraFlags; std::string extraFlags;
this->LocalGenerator->AppendFlags(extraFlags, this->LocalGenerator->AppendFlags(extraFlags,
this->Target->GetProperty("LINK_FLAGS")); this->GeneratorTarget->GetProperty("LINK_FLAGS"));
std::string linkFlagsConfig = "LINK_FLAGS_"; std::string linkFlagsConfig = "LINK_FLAGS_";
linkFlagsConfig += cmSystemTools::UpperCase(this->ConfigName); linkFlagsConfig += cmSystemTools::UpperCase(this->ConfigName);
this->LocalGenerator->AppendFlags this->LocalGenerator->AppendFlags
(extraFlags, this->Target->GetProperty(linkFlagsConfig)); (extraFlags, this->GeneratorTarget->GetProperty(linkFlagsConfig));
this->LocalGenerator->AddConfigVariableFlags this->LocalGenerator->AddConfigVariableFlags
(extraFlags, "CMAKE_MODULE_LINKER_FLAGS", this->ConfigName); (extraFlags, "CMAKE_MODULE_LINKER_FLAGS", this->ConfigName);
this->AddModuleDefinitionFlag(extraFlags); this->AddModuleDefinitionFlag(extraFlags);
@ -213,11 +213,11 @@ void cmMakefileLibraryTargetGenerator::WriteFrameworkRules(bool relink)
std::string extraFlags; std::string extraFlags;
this->LocalGenerator->AppendFlags(extraFlags, this->LocalGenerator->AppendFlags(extraFlags,
this->Target->GetProperty("LINK_FLAGS")); this->GeneratorTarget->GetProperty("LINK_FLAGS"));
std::string linkFlagsConfig = "LINK_FLAGS_"; std::string linkFlagsConfig = "LINK_FLAGS_";
linkFlagsConfig += cmSystemTools::UpperCase(this->ConfigName); linkFlagsConfig += cmSystemTools::UpperCase(this->ConfigName);
this->LocalGenerator->AppendFlags this->LocalGenerator->AppendFlags
(extraFlags, this->Target->GetProperty(linkFlagsConfig)); (extraFlags, this->GeneratorTarget->GetProperty(linkFlagsConfig));
this->LocalGenerator->AddConfigVariableFlags this->LocalGenerator->AddConfigVariableFlags
(extraFlags, "CMAKE_MACOSX_FRAMEWORK_LINKER_FLAGS", this->ConfigName); (extraFlags, "CMAKE_MACOSX_FRAMEWORK_LINKER_FLAGS", this->ConfigName);
@ -244,7 +244,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules
if(linkLanguage.empty()) if(linkLanguage.empty())
{ {
cmSystemTools::Error("Cannot determine link language for target \"", cmSystemTools::Error("Cannot determine link language for target \"",
this->Target->GetName().c_str(), "\"."); this->GeneratorTarget->GetName().c_str(), "\".");
return; return;
} }
@ -273,13 +273,13 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules
// Construct the full path version of the names. // Construct the full path version of the names.
std::string outpath; std::string outpath;
std::string outpathImp; std::string outpathImp;
if(this->Target->IsFrameworkOnApple()) if(this->GeneratorTarget->IsFrameworkOnApple())
{ {
outpath = this->GeneratorTarget->GetDirectory(this->ConfigName); outpath = this->GeneratorTarget->GetDirectory(this->ConfigName);
this->OSXBundleGenerator->CreateFramework(targetName, outpath); this->OSXBundleGenerator->CreateFramework(targetName, outpath);
outpath += "/"; outpath += "/";
} }
else if(this->Target->IsCFBundleOnApple()) else if(this->GeneratorTarget->IsCFBundleOnApple())
{ {
outpath = this->GeneratorTarget->GetDirectory(this->ConfigName); outpath = this->GeneratorTarget->GetDirectory(this->ConfigName);
this->OSXBundleGenerator->CreateCFBundle(targetName, outpath); this->OSXBundleGenerator->CreateCFBundle(targetName, outpath);
@ -360,7 +360,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules
buildEcho += " shared library "; buildEcho += " shared library ";
break; break;
case cmState::MODULE_LIBRARY: case cmState::MODULE_LIBRARY:
if (this->Target->IsCFBundleOnApple()) if (this->GeneratorTarget->IsCFBundleOnApple())
buildEcho += " CFBundle"; buildEcho += " CFBundle";
buildEcho += " shared module "; buildEcho += " shared module ";
break; break;
@ -458,10 +458,10 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules
{ {
this->LocalGenerator this->LocalGenerator
->AppendCustomCommands(commands, this->Target->GetPreBuildCommands(), ->AppendCustomCommands(commands, this->Target->GetPreBuildCommands(),
this->Target); this->GeneratorTarget);
this->LocalGenerator this->LocalGenerator
->AppendCustomCommands(commands, this->Target->GetPreLinkCommands(), ->AppendCustomCommands(commands, this->Target->GetPreLinkCommands(),
this->Target); this->GeneratorTarget);
} }
// Determine whether a link script will be used. // Determine whether a link script will be used.
@ -569,12 +569,12 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules
if (this->GeneratorTarget->GetType() == cmState::SHARED_LIBRARY && if (this->GeneratorTarget->GetType() == cmState::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->GeneratorTarget->GetPropertyAsBool("WINDOWS_EXPORT_ALL_SYMBOLS"))
{ {
std::string name_of_def_file = std::string name_of_def_file =
this->GeneratorTarget->GetSupportDirectory(); this->GeneratorTarget->GetSupportDirectory();
name_of_def_file += std::string("/") + name_of_def_file += std::string("/") +
this->Target->GetName(); this->GeneratorTarget->GetName();
name_of_def_file += ".def"; name_of_def_file += ".def";
std::string cmd = cmSystemTools::GetCMakeCommand(); std::string cmd = cmSystemTools::GetCMakeCommand();
cmd = this->Convert(cmd, cmLocalGenerator::NONE, cmd = this->Convert(cmd, cmLocalGenerator::NONE,
@ -630,7 +630,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules
std::ostringstream minorStream; std::ostringstream minorStream;
int major; int major;
int minor; int minor;
this->Target->GetTargetVersion(major, minor); this->GeneratorTarget->GetTargetVersion(major, minor);
majorStream << major; majorStream << major;
minorStream << minor; minorStream << minor;
targetVersionMajor = majorStream.str(); targetVersionMajor = majorStream.str();
@ -640,7 +640,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules
vars.TargetVersionMinor = targetVersionMinor.c_str(); vars.TargetVersionMinor = targetVersionMinor.c_str();
vars.RuleLauncher = "RULE_LAUNCH_LINK"; vars.RuleLauncher = "RULE_LAUNCH_LINK";
vars.CMTarget = this->Target; vars.CMTarget = this->GeneratorTarget;
vars.Language = linkLanguage.c_str(); vars.Language = linkLanguage.c_str();
vars.Objects = buildObjs.c_str(); vars.Objects = buildObjs.c_str();
std::string objectDir = this->GeneratorTarget->GetSupportDirectory(); std::string objectDir = this->GeneratorTarget->GetSupportDirectory();
@ -791,7 +791,8 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules
// Add a rule to create necessary symlinks for the library. // Add a rule to create necessary symlinks for the library.
// Frameworks are handled by cmOSXBundleGenerator. // Frameworks are handled by cmOSXBundleGenerator.
if(targetOutPath != targetOutPathReal && !this->Target->IsFrameworkOnApple()) if(targetOutPath != targetOutPathReal
&& !this->GeneratorTarget->IsFrameworkOnApple())
{ {
std::string symlink = "$(CMAKE_COMMAND) -E cmake_symlink_library "; std::string symlink = "$(CMAKE_COMMAND) -E cmake_symlink_library ";
symlink += targetOutPathReal; symlink += targetOutPathReal;
@ -811,7 +812,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules
{ {
this->LocalGenerator-> this->LocalGenerator->
AppendCustomCommands(commands, this->Target->GetPostBuildCommands(), AppendCustomCommands(commands, this->Target->GetPostBuildCommands(),
this->Target); this->GeneratorTarget);
} }
// Compute the list of outputs. // Compute the list of outputs.
@ -862,7 +863,7 @@ cmMakefileLibraryTargetGenerator
int major; int major;
int minor; int minor;
int patch; int patch;
this->Target->GetTargetVersion(so, major, minor, patch); this->GeneratorTarget->GetTargetVersion(so, major, minor, patch);
if(major > 0 || minor > 0 || patch > 0) if(major > 0 || minor > 0 || patch > 0)
{ {
// Append the flag since a non-zero version is specified. // Append the flag since a non-zero version is specified.

View File

@ -248,7 +248,8 @@ void cmMakefileTargetGenerator::WriteCommonCodeRules()
// Write an empty dependency file. // Write an empty dependency file.
cmGeneratedFileStream depFileStream(dependFileNameFull.c_str()); cmGeneratedFileStream depFileStream(dependFileNameFull.c_str());
depFileStream depFileStream
<< "# Empty dependencies file for " << this->Target->GetName() << ".\n" << "# Empty dependencies file for "
<< this->GeneratorTarget->GetName() << ".\n"
<< "# This may be replaced when dependencies are built." << std::endl; << "# This may be replaced when dependencies are built." << std::endl;
} }
@ -394,7 +395,7 @@ void cmMakefileTargetGenerator
err << "Warning: Source file \"" err << "Warning: Source file \""
<< source.GetFullPath() << source.GetFullPath()
<< "\" is listed multiple times for target \"" << "\" is listed multiple times for target \""
<< this->Target->GetName() << this->GeneratorTarget->GetName()
<< "\"."; << "\".";
cmSystemTools::Message(err.str().c_str(), "Warning"); cmSystemTools::Message(err.str().c_str(), "Warning");
return; return;
@ -588,7 +589,7 @@ cmMakefileTargetGenerator
} }
cmLocalGenerator::RuleVariables vars; cmLocalGenerator::RuleVariables vars;
vars.RuleLauncher = "RULE_LAUNCH_COMPILE"; vars.RuleLauncher = "RULE_LAUNCH_COMPILE";
vars.CMTarget = this->Target; vars.CMTarget = this->GeneratorTarget;
vars.Language = lang.c_str(); vars.Language = lang.c_str();
vars.Target = targetOutPathReal.c_str(); vars.Target = targetOutPathReal.c_str();
vars.TargetPDB = targetOutPathPDB.c_str(); vars.TargetPDB = targetOutPathPDB.c_str();
@ -666,7 +667,7 @@ cmMakefileTargetGenerator
if (!compileCommands.empty() && (lang == "C" || lang == "CXX")) if (!compileCommands.empty() && (lang == "C" || lang == "CXX"))
{ {
std::string const iwyu_prop = lang + "_INCLUDE_WHAT_YOU_USE"; std::string const iwyu_prop = lang + "_INCLUDE_WHAT_YOU_USE";
const char *iwyu = this->Target->GetProperty(iwyu_prop); const char *iwyu = this->GeneratorTarget->GetProperty(iwyu_prop);
if (iwyu && *iwyu) if (iwyu && *iwyu)
{ {
std::string run_iwyu = "$(CMAKE_COMMAND) -E __run_iwyu --iwyu="; std::string run_iwyu = "$(CMAKE_COMMAND) -E __run_iwyu --iwyu=";
@ -680,7 +681,7 @@ cmMakefileTargetGenerator
if (!compileCommands.empty() && (lang == "C" || lang == "CXX")) if (!compileCommands.empty() && (lang == "C" || lang == "CXX"))
{ {
std::string const clauncher_prop = lang + "_COMPILER_LAUNCHER"; std::string const clauncher_prop = lang + "_COMPILER_LAUNCHER";
const char *clauncher = this->Target->GetProperty(clauncher_prop); const char *clauncher = this->GeneratorTarget->GetProperty(clauncher_prop);
if (clauncher && *clauncher) if (clauncher && *clauncher)
{ {
std::vector<std::string> launcher_cmd; std::vector<std::string> launcher_cmd;
@ -1039,7 +1040,7 @@ void cmMakefileTargetGenerator::WriteTargetDependRules()
return; return;
} }
this->LocalGenerator-> this->LocalGenerator->
WriteDependLanguageInfo(*this->InfoFileStream,*this->Target); WriteDependLanguageInfo(*this->InfoFileStream, this->GeneratorTarget);
// Store multiple output pairs in the depend info file. // Store multiple output pairs in the depend info file.
if(!this->MultipleOutputPairs.empty()) if(!this->MultipleOutputPairs.empty())
@ -1210,7 +1211,8 @@ void cmMakefileTargetGenerator
// Now append the actual user-specified commands. // Now append the actual user-specified commands.
std::ostringstream content; std::ostringstream content;
this->LocalGenerator->AppendCustomCommand(commands, ccg, this->Target, false, this->LocalGenerator->AppendCustomCommand(commands, ccg,
this->GeneratorTarget, false,
cmLocalGenerator::HOME_OUTPUT, cmLocalGenerator::HOME_OUTPUT,
&content); &content);
@ -1267,10 +1269,10 @@ cmMakefileTargetGenerator
// Write a make variable assignment that lists all objects for the // Write a make variable assignment that lists all objects for the
// target. // target.
variableName = variableName =
this->LocalGenerator->CreateMakeVariable(this->Target->GetName(), this->LocalGenerator->CreateMakeVariable(this->GeneratorTarget->GetName(),
"_OBJECTS"); "_OBJECTS");
*this->BuildFileStream *this->BuildFileStream
<< "# Object files for target " << this->Target->GetName() << "\n" << "# Object files for target " << this->GeneratorTarget->GetName() << "\n"
<< variableName << " ="; << variableName << " =";
std::string object; std::string object;
const char* lineContinue = const char* lineContinue =
@ -1292,12 +1294,12 @@ cmMakefileTargetGenerator
// Write a make variable assignment that lists all external objects // Write a make variable assignment that lists all external objects
// for the target. // for the target.
variableNameExternal = variableNameExternal =
this->LocalGenerator->CreateMakeVariable(this->Target->GetName(), this->LocalGenerator->CreateMakeVariable(this->GeneratorTarget->GetName(),
"_EXTERNAL_OBJECTS"); "_EXTERNAL_OBJECTS");
*this->BuildFileStream *this->BuildFileStream
<< "\n" << "\n"
<< "# External object files for target " << "# External object files for target "
<< this->Target->GetName() << "\n" << this->GeneratorTarget->GetName() << "\n"
<< variableNameExternal << " ="; << variableNameExternal << " =";
for(std::vector<std::string>::const_iterator i = for(std::vector<std::string>::const_iterator i =
this->ExternalObjects.begin(); this->ExternalObjects.begin();
@ -1512,7 +1514,7 @@ void cmMakefileTargetGenerator
// Add user-specified dependencies. // Add user-specified dependencies.
if(const char* linkDepends = if(const char* linkDepends =
this->Target->GetProperty("LINK_DEPENDS")) this->GeneratorTarget->GetProperty("LINK_DEPENDS"))
{ {
cmSystemTools::ExpandListArgument(linkDepends, depends); cmSystemTools::ExpandListArgument(linkDepends, depends);
} }

View File

@ -42,7 +42,8 @@ void cmMakefileUtilityTargetGenerator::WriteRuleFiles()
this->CreateRuleFile(); this->CreateRuleFile();
*this->BuildFileStream *this->BuildFileStream
<< "# Utility rule file for " << this->Target->GetName() << ".\n\n"; << "# Utility rule file for "
<< this->GeneratorTarget->GetName() << ".\n\n";
if(!this->NoRuleMessages) if(!this->NoRuleMessages)
{ {
@ -73,13 +74,13 @@ void cmMakefileUtilityTargetGenerator::WriteRuleFiles()
(depends, this->Target->GetPostBuildCommands()); (depends, this->Target->GetPostBuildCommands());
this->LocalGenerator->AppendCustomCommands this->LocalGenerator->AppendCustomCommands
(commands, this->Target->GetPreBuildCommands(), this->Target); (commands, this->Target->GetPreBuildCommands(), this->GeneratorTarget);
// Depend on all custom command outputs for sources // Depend on all custom command outputs for sources
this->DriveCustomCommands(depends); this->DriveCustomCommands(depends);
this->LocalGenerator->AppendCustomCommands this->LocalGenerator->AppendCustomCommands
(commands, this->Target->GetPostBuildCommands(), this->Target); (commands, this->Target->GetPostBuildCommands(), this->GeneratorTarget);
// Add dependencies on targets that must be built first. // Add dependencies on targets that must be built first.
this->AppendTargetDepends(depends); this->AppendTargetDepends(depends);
@ -101,11 +102,11 @@ void cmMakefileUtilityTargetGenerator::WriteRuleFiles()
// Write the rule. // Write the rule.
this->LocalGenerator->WriteMakeRule(*this->BuildFileStream, 0, this->LocalGenerator->WriteMakeRule(*this->BuildFileStream, 0,
this->Target->GetName(), this->GeneratorTarget->GetName(),
depends, commands, true); depends, commands, true);
// Write the main driver rule to build everything in this target. // Write the main driver rule to build everything in this target.
this->WriteTargetDriverRule(this->Target->GetName(), false); this->WriteTargetDriverRule(this->GeneratorTarget->GetName(), false);
// Write clean target // Write clean target
this->WriteTargetCleanRules(); this->WriteTargetCleanRules();

View File

@ -77,7 +77,7 @@ void cmNinjaNormalTargetGenerator::Generate()
if (this->TargetLinkLanguage.empty()) { if (this->TargetLinkLanguage.empty()) {
cmSystemTools::Error("CMake can not determine linker language for " cmSystemTools::Error("CMake can not determine linker language for "
"target: ", "target: ",
this->GetTarget()->GetName().c_str()); this->GetGeneratorTarget()->GetName().c_str());
return; return;
} }
@ -139,7 +139,7 @@ const char *cmNinjaNormalTargetGenerator::GetVisibleTypeName() const
case cmState::SHARED_LIBRARY: case cmState::SHARED_LIBRARY:
return "shared library"; return "shared library";
case cmState::MODULE_LIBRARY: case cmState::MODULE_LIBRARY:
if (this->GetTarget()->IsCFBundleOnApple()) if (this->GetGeneratorTarget()->IsCFBundleOnApple())
return "CFBundle shared module"; return "CFBundle shared module";
else else
return "shared module"; return "shared module";
@ -158,7 +158,8 @@ cmNinjaNormalTargetGenerator
+ "_" + "_"
+ cmState::GetTargetTypeName(this->GetGeneratorTarget()->GetType()) + cmState::GetTargetTypeName(this->GetGeneratorTarget()->GetType())
+ "_LINKER__" + "_LINKER__"
+ cmGlobalNinjaGenerator::EncodeRuleName(this->GetTarget()->GetName()) + cmGlobalNinjaGenerator::EncodeRuleName(
this->GetGeneratorTarget()->GetName())
; ;
} }
@ -177,7 +178,7 @@ cmNinjaNormalTargetGenerator
if (!this->GetGlobalGenerator()->HasRule(ruleName)) { if (!this->GetGlobalGenerator()->HasRule(ruleName)) {
cmLocalGenerator::RuleVariables vars; cmLocalGenerator::RuleVariables vars;
vars.RuleLauncher = "RULE_LAUNCH_LINK"; vars.RuleLauncher = "RULE_LAUNCH_LINK";
vars.CMTarget = this->GetTarget(); vars.CMTarget = this->GetGeneratorTarget();
vars.Language = this->TargetLinkLanguage.c_str(); vars.Language = this->TargetLinkLanguage.c_str();
std::string responseFlag; std::string responseFlag;
@ -227,7 +228,7 @@ cmNinjaNormalTargetGenerator
std::ostringstream minorStream; std::ostringstream minorStream;
int major; int major;
int minor; int minor;
this->GetTarget()->GetTargetVersion(major, minor); this->GetGeneratorTarget()->GetTargetVersion(major, minor);
majorStream << major; majorStream << major;
minorStream << minor; minorStream << minor;
targetVersionMajor = majorStream.str(); targetVersionMajor = majorStream.str();
@ -280,7 +281,7 @@ cmNinjaNormalTargetGenerator
} }
if (this->TargetNameOut != this->TargetNameReal && if (this->TargetNameOut != this->TargetNameReal &&
!this->GetTarget()->IsFrameworkOnApple()) { !this->GetGeneratorTarget()->IsFrameworkOnApple()) {
std::string cmakeCommand = std::string cmakeCommand =
this->GetLocalGenerator()->ConvertToOutputFormat( this->GetLocalGenerator()->ConvertToOutputFormat(
cmSystemTools::GetCMakeCommand(), cmLocalGenerator::SHELL); cmSystemTools::GetCMakeCommand(), cmLocalGenerator::SHELL);
@ -411,7 +412,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
gt.GetFullPath(cfgName, gt.GetFullPath(cfgName,
/*implib=*/true)); /*implib=*/true));
if (target.IsAppBundleOnApple()) if (gt.IsAppBundleOnApple())
{ {
// Create the app bundle // Create the app bundle
std::string outpath = gt.GetDirectory(cfgName); std::string outpath = gt.GetDirectory(cfgName);
@ -427,13 +428,13 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
targetOutputReal += this->TargetNameReal; targetOutputReal += this->TargetNameReal;
targetOutputReal = this->ConvertToNinjaPath(targetOutputReal); targetOutputReal = this->ConvertToNinjaPath(targetOutputReal);
} }
else if (target.IsFrameworkOnApple()) else if (gt.IsFrameworkOnApple())
{ {
// Create the library framework. // Create the library framework.
this->OSXBundleGenerator->CreateFramework(this->TargetNameOut, this->OSXBundleGenerator->CreateFramework(this->TargetNameOut,
gt.GetDirectory(cfgName)); gt.GetDirectory(cfgName));
} }
else if(target.IsCFBundleOnApple()) else if(gt.IsCFBundleOnApple())
{ {
// Create the core foundation bundle. // Create the core foundation bundle.
this->OSXBundleGenerator->CreateCFBundle(this->TargetNameOut, this->OSXBundleGenerator->CreateCFBundle(this->TargetNameOut,
@ -731,7 +732,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
&usedResponseFile); &usedResponseFile);
this->WriteLinkRule(usedResponseFile); this->WriteLinkRule(usedResponseFile);
if (targetOutput != targetOutputReal && !target.IsFrameworkOnApple()) if (targetOutput != targetOutputReal && !gt.IsFrameworkOnApple())
{ {
if (targetType == cmState::EXECUTABLE) if (targetType == cmState::EXECUTABLE)
{ {

View File

@ -92,7 +92,7 @@ std::string cmNinjaTargetGenerator::LanguageCompilerRule(
const std::string& lang) const const std::string& lang) const
{ {
return lang + "_COMPILER__" + return lang + "_COMPILER__" +
cmGlobalNinjaGenerator::EncodeRuleName(this->Target->GetName()); cmGlobalNinjaGenerator::EncodeRuleName(this->GeneratorTarget->GetName());
} }
std::string std::string
@ -218,7 +218,8 @@ cmNinjaDeps cmNinjaTargetGenerator::ComputeLinkDeps() const
} }
// Add user-specified dependencies. // Add user-specified dependencies.
if (const char* linkDepends = this->Target->GetProperty("LINK_DEPENDS")) if (const char* linkDepends =
this->GeneratorTarget->GetProperty("LINK_DEPENDS"))
{ {
std::vector<std::string> linkDeps; std::vector<std::string> linkDeps;
cmSystemTools::ExpandListArgument(linkDepends, linkDeps); cmSystemTools::ExpandListArgument(linkDepends, linkDeps);
@ -271,7 +272,7 @@ cmNinjaTargetGenerator
std::string cmNinjaTargetGenerator::GetTargetName() const std::string cmNinjaTargetGenerator::GetTargetName() const
{ {
return this->Target->GetName(); return this->GeneratorTarget->GetName();
} }
@ -334,7 +335,7 @@ cmNinjaTargetGenerator
{ {
cmLocalGenerator::RuleVariables vars; cmLocalGenerator::RuleVariables vars;
vars.RuleLauncher = "RULE_LAUNCH_COMPILE"; vars.RuleLauncher = "RULE_LAUNCH_COMPILE";
vars.CMTarget = this->GetTarget(); vars.CMTarget = this->GetGeneratorTarget();
vars.Language = lang.c_str(); vars.Language = lang.c_str();
vars.Source = "$in"; vars.Source = "$in";
vars.Object = "$out"; vars.Object = "$out";
@ -410,7 +411,7 @@ cmNinjaTargetGenerator
if (!compileCmds.empty() && (lang == "C" || lang == "CXX")) if (!compileCmds.empty() && (lang == "C" || lang == "CXX"))
{ {
std::string const iwyu_prop = lang + "_INCLUDE_WHAT_YOU_USE"; std::string const iwyu_prop = lang + "_INCLUDE_WHAT_YOU_USE";
const char *iwyu = this->Target->GetProperty(iwyu_prop); const char *iwyu = this->GeneratorTarget->GetProperty(iwyu_prop);
if (iwyu && *iwyu) if (iwyu && *iwyu)
{ {
std::string run_iwyu = std::string run_iwyu =
@ -427,7 +428,7 @@ cmNinjaTargetGenerator
if (!compileCmds.empty() && (lang == "C" || lang == "CXX")) if (!compileCmds.empty() && (lang == "C" || lang == "CXX"))
{ {
std::string const clauncher_prop = lang + "_COMPILER_LAUNCHER"; std::string const clauncher_prop = lang + "_COMPILER_LAUNCHER";
const char *clauncher = this->Target->GetProperty(clauncher_prop); const char *clauncher = this->GeneratorTarget->GetProperty(clauncher_prop);
if (clauncher && *clauncher) if (clauncher && *clauncher)
{ {
std::vector<std::string> launcher_cmd; std::vector<std::string> launcher_cmd;

View File

@ -90,7 +90,8 @@ void cmNinjaUtilityTargetGenerator::Generate()
} else { } else {
std::string command = std::string command =
this->GetLocalGenerator()->BuildCommandLine(commands); this->GetLocalGenerator()->BuildCommandLine(commands);
const char *echoStr = this->GetTarget()->GetProperty("EchoString"); const char *echoStr =
this->GetGeneratorTarget()->GetProperty("EchoString");
std::string desc; std::string desc;
if (echoStr) if (echoStr)
desc = echoStr; desc = echoStr;

View File

@ -59,7 +59,7 @@ void cmOSXBundleGenerator::CreateAppBundle(const std::string& targetName,
plist += "/"; plist += "/";
plist += this->GT->GetAppBundleDirectory(this->ConfigName, true); plist += this->GT->GetAppBundleDirectory(this->ConfigName, true);
plist += "/Info.plist"; plist += "/Info.plist";
this->LocalGenerator->GenerateAppleInfoPList(this->GT->Target, this->LocalGenerator->GenerateAppleInfoPList(this->GT,
targetName, targetName,
plist.c_str()); plist.c_str());
this->Makefile->AddCMakeOutputFile(plist); this->Makefile->AddCMakeOutputFile(plist);
@ -90,7 +90,7 @@ void cmOSXBundleGenerator::CreateFramework(
std::string plist = newoutpath; std::string plist = newoutpath;
plist += "/Resources/Info.plist"; plist += "/Resources/Info.plist";
std::string name = cmSystemTools::GetFilenameName(targetName); std::string name = cmSystemTools::GetFilenameName(targetName);
this->LocalGenerator->GenerateFrameworkInfoPList(this->GT->Target, this->LocalGenerator->GenerateFrameworkInfoPList(this->GT,
name, name,
plist.c_str()); plist.c_str());
@ -182,7 +182,7 @@ void cmOSXBundleGenerator::CreateCFBundle(const std::string& targetName,
this->GT->GetCFBundleDirectory(this->ConfigName, true); this->GT->GetCFBundleDirectory(this->ConfigName, true);
plist += "/Info.plist"; plist += "/Info.plist";
std::string name = cmSystemTools::GetFilenameName(targetName); std::string name = cmSystemTools::GetFilenameName(targetName);
this->LocalGenerator->GenerateAppleInfoPList(this->GT->Target, this->LocalGenerator->GenerateAppleInfoPList(this->GT,
name, name,
plist.c_str()); plist.c_str());
this->Makefile->AddCMakeOutputFile(plist); this->Makefile->AddCMakeOutputFile(plist);

View File

@ -120,7 +120,7 @@ static void GetCompileDefinitionsAndDirectories(
incs = cmJoin(includeDirs, ";"); incs = cmJoin(includeDirs, ";");
std::set<std::string> defines; std::set<std::string> defines;
localGen->AddCompileDefinitions(defines, target->Target, config, "CXX"); localGen->AddCompileDefinitions(defines, target, config, "CXX");
defs += cmJoin(defines, ";"); defs += cmJoin(defines, ";");
} }
@ -132,6 +132,7 @@ static void SetupAutoMocTarget(cmGeneratorTarget const* target,
std::map<std::string, std::string> &configIncludes, std::map<std::string, std::string> &configIncludes,
std::map<std::string, std::string> &configDefines) std::map<std::string, std::string> &configDefines)
{ {
cmLocalGenerator* lg = target->GetLocalGenerator();
cmMakefile* makefile = target->Target->GetMakefile(); cmMakefile* makefile = target->Target->GetMakefile();
const char* tmp = target->GetProperty("AUTOMOC_MOC_OPTIONS"); const char* tmp = target->GetProperty("AUTOMOC_MOC_OPTIONS");
@ -188,7 +189,8 @@ static void SetupAutoMocTarget(cmGeneratorTarget const* target,
const char *qtVersion = makefile->GetDefinition("_target_qt_version"); const char *qtVersion = makefile->GetDefinition("_target_qt_version");
if (strcmp(qtVersion, "5") == 0) if (strcmp(qtVersion, "5") == 0)
{ {
cmTarget *qt5Moc = makefile->FindTargetToUse("Qt5::moc"); cmGeneratorTarget *qt5Moc =
lg->FindGeneratorTargetToUse("Qt5::moc");
if (!qt5Moc) if (!qt5Moc)
{ {
cmSystemTools::Error("Qt5::moc target not found ", cmSystemTools::Error("Qt5::moc target not found ",
@ -200,7 +202,8 @@ static void SetupAutoMocTarget(cmGeneratorTarget const* target,
} }
else if (strcmp(qtVersion, "4") == 0) else if (strcmp(qtVersion, "4") == 0)
{ {
cmTarget *qt4Moc = makefile->FindTargetToUse("Qt4::moc"); cmGeneratorTarget *qt4Moc =
lg->FindGeneratorTargetToUse("Qt4::moc");
if (!qt4Moc) if (!qt4Moc)
{ {
cmSystemTools::Error("Qt4::moc target not found ", cmSystemTools::Error("Qt4::moc target not found ",
@ -230,6 +233,7 @@ static void SetupAutoUicTarget(cmGeneratorTarget const* target,
std::vector<std::string> const& skipUic, std::vector<std::string> const& skipUic,
std::map<std::string, std::string> &configUicOptions) std::map<std::string, std::string> &configUicOptions)
{ {
cmLocalGenerator* lg = target->GetLocalGenerator();
cmMakefile *makefile = target->Target->GetMakefile(); cmMakefile *makefile = target->Target->GetMakefile();
std::set<std::string> skipped; std::set<std::string> skipped;
@ -303,7 +307,8 @@ static void SetupAutoUicTarget(cmGeneratorTarget const* target,
std::string targetName = target->GetName(); std::string targetName = target->GetName();
if (strcmp(qtVersion, "5") == 0) if (strcmp(qtVersion, "5") == 0)
{ {
cmTarget *qt5Uic = makefile->FindTargetToUse("Qt5::uic"); cmGeneratorTarget *qt5Uic =
lg->FindGeneratorTargetToUse("Qt5::uic");
if (!qt5Uic) if (!qt5Uic)
{ {
// Project does not use Qt5Widgets, but has AUTOUIC ON anyway // Project does not use Qt5Widgets, but has AUTOUIC ON anyway
@ -316,7 +321,8 @@ static void SetupAutoUicTarget(cmGeneratorTarget const* target,
} }
else if (strcmp(qtVersion, "4") == 0) else if (strcmp(qtVersion, "4") == 0)
{ {
cmTarget *qt4Uic = makefile->FindTargetToUse("Qt4::uic"); cmGeneratorTarget *qt4Uic =
lg->FindGeneratorTargetToUse("Qt4::uic");
if (!qt4Uic) if (!qt4Uic)
{ {
cmSystemTools::Error("Qt4::uic target not found ", cmSystemTools::Error("Qt4::uic target not found ",
@ -335,6 +341,7 @@ static void SetupAutoUicTarget(cmGeneratorTarget const* target,
static std::string GetRccExecutable(cmGeneratorTarget const* target) static std::string GetRccExecutable(cmGeneratorTarget const* target)
{ {
cmLocalGenerator* lg = target->GetLocalGenerator();
cmMakefile *makefile = target->Target->GetMakefile(); cmMakefile *makefile = target->Target->GetMakefile();
const char *qtVersion = makefile->GetDefinition("_target_qt_version"); const char *qtVersion = makefile->GetDefinition("_target_qt_version");
if (!qtVersion) if (!qtVersion)
@ -355,7 +362,8 @@ static std::string GetRccExecutable(cmGeneratorTarget const* target)
std::string targetName = target->GetName(); std::string targetName = target->GetName();
if (strcmp(qtVersion, "5") == 0) if (strcmp(qtVersion, "5") == 0)
{ {
cmTarget *qt5Rcc = makefile->FindTargetToUse("Qt5::rcc"); cmGeneratorTarget *qt5Rcc =
lg->FindGeneratorTargetToUse("Qt5::rcc");
if (!qt5Rcc) if (!qt5Rcc)
{ {
cmSystemTools::Error("Qt5::rcc target not found ", cmSystemTools::Error("Qt5::rcc target not found ",
@ -366,7 +374,8 @@ static std::string GetRccExecutable(cmGeneratorTarget const* target)
} }
else if (strcmp(qtVersion, "4") == 0) else if (strcmp(qtVersion, "4") == 0)
{ {
cmTarget *qt4Rcc = makefile->FindTargetToUse("Qt4::rcc"); cmGeneratorTarget *qt4Rcc =
lg->FindGeneratorTargetToUse("Qt4::rcc");
if (!qt4Rcc) if (!qt4Rcc)
{ {
cmSystemTools::Error("Qt4::rcc target not found ", cmSystemTools::Error("Qt4::rcc target not found ",

View File

@ -344,17 +344,6 @@ bool cmTarget::IsExecutableWithExports() const
this->GetPropertyAsBool("ENABLE_EXPORTS")); this->GetPropertyAsBool("ENABLE_EXPORTS"));
} }
//----------------------------------------------------------------------------
bool cmTarget::IsLinkable() const
{
return (this->GetType() == cmState::STATIC_LIBRARY ||
this->GetType() == cmState::SHARED_LIBRARY ||
this->GetType() == cmState::MODULE_LIBRARY ||
this->GetType() == cmState::UNKNOWN_LIBRARY ||
this->GetType() == cmState::INTERFACE_LIBRARY ||
this->IsExecutableWithExports());
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
bool cmTarget::HasImportLibrary() const bool cmTarget::HasImportLibrary() const
{ {
@ -379,21 +368,6 @@ bool cmTarget::IsAppBundleOnApple() const
this->GetPropertyAsBool("MACOSX_BUNDLE")); this->GetPropertyAsBool("MACOSX_BUNDLE"));
} }
//----------------------------------------------------------------------------
bool cmTarget::IsCFBundleOnApple() const
{
return (this->GetType() == cmState::MODULE_LIBRARY &&
this->Makefile->IsOn("APPLE") &&
this->GetPropertyAsBool("BUNDLE"));
}
//----------------------------------------------------------------------------
bool cmTarget::IsXCTestOnApple() const
{
return (this->IsCFBundleOnApple() &&
this->GetPropertyAsBool("XCTEST"));
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void cmTarget::AddTracedSources(std::vector<std::string> const& srcs) void cmTarget::AddTracedSources(std::vector<std::string> const& srcs)
{ {
@ -1316,7 +1290,6 @@ void cmTarget::SetProperty(const std::string& prop, const char* value)
else else
{ {
this->Properties.SetProperty(prop, value); this->Properties.SetProperty(prop, value);
this->MaybeInvalidatePropertyCache(prop);
} }
} }
@ -1409,30 +1382,9 @@ void cmTarget::AppendProperty(const std::string& prop, const char* value,
else else
{ {
this->Properties.AppendProperty(prop, value, asString); this->Properties.AppendProperty(prop, value, asString);
this->MaybeInvalidatePropertyCache(prop);
} }
} }
//----------------------------------------------------------------------------
std::string cmTarget::GetExportName() const
{
const char *exportName = this->GetProperty("EXPORT_NAME");
if (exportName && *exportName)
{
if (!cmGeneratorExpression::IsValidTargetName(exportName))
{
std::ostringstream e;
e << "EXPORT_NAME property \"" << exportName << "\" for \""
<< this->GetName() << "\": is not valid.";
cmSystemTools::Error(e.str().c_str());
return "";
}
return exportName;
}
return this->GetName();
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void cmTarget::AppendBuildInterfaceIncludes() void cmTarget::AppendBuildInterfaceIncludes()
{ {
@ -1507,16 +1459,6 @@ void cmTarget::InsertCompileDefinition(std::string const& entry,
this->Internal->CompileDefinitionsBacktraces.push_back(bt); this->Internal->CompileDefinitionsBacktraces.push_back(bt);
} }
//----------------------------------------------------------------------------
void cmTarget::MaybeInvalidatePropertyCache(const std::string& prop)
{
// Wipe out maps caching information affected by this property.
if(this->IsImported() && cmHasLiteralPrefix(prop, "IMPORTED"))
{
this->ImportInfoMap.clear();
}
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
static void cmTargetCheckLINK_INTERFACE_LIBRARIES( static void cmTargetCheckLINK_INTERFACE_LIBRARIES(
const std::string& prop, const char* value, cmMakefile* context, const std::string& prop, const char* value, cmMakefile* context,
@ -1627,53 +1569,6 @@ bool cmTarget::HaveWellDefinedOutputFiles() const
this->GetType() == cmState::EXECUTABLE; this->GetType() == cmState::EXECUTABLE;
} }
//----------------------------------------------------------------------------
const char* cmTarget::ImportedGetLocation(const std::string& config) const
{
static std::string location;
assert(this->IsImported());
location = this->ImportedGetFullPath(config, false);
return location.c_str();
}
//----------------------------------------------------------------------------
void cmTarget::GetTargetVersion(int& major, int& minor) const
{
int patch;
this->GetTargetVersion(false, major, minor, patch);
}
//----------------------------------------------------------------------------
void cmTarget::GetTargetVersion(bool soversion,
int& major, int& minor, int& patch) const
{
// Set the default values.
major = 0;
minor = 0;
patch = 0;
assert(this->GetType() != cmState::INTERFACE_LIBRARY);
// Look for a VERSION or SOVERSION property.
const char* prop = soversion? "SOVERSION" : "VERSION";
if(const char* version = this->GetProperty(prop))
{
// Try to parse the version number and store the results that were
// successfully parsed.
int parsed_major;
int parsed_minor;
int parsed_patch;
switch(sscanf(version, "%d.%d.%d",
&parsed_major, &parsed_minor, &parsed_patch))
{
case 3: patch = parsed_patch; // no break!
case 2: minor = parsed_minor; // no break!
case 1: major = parsed_major; // no break!
default: break;
}
}
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
bool cmTarget::HandleLocationPropertyPolicy(cmMakefile* context) const bool cmTarget::HandleLocationPropertyPolicy(cmMakefile* context) const
{ {
@ -2100,21 +1995,75 @@ const char* cmTarget::GetPrefixVariableInternal(bool implib) const
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
std::string std::string
cmTarget::GetFullNameImported(const std::string& config, bool implib) const cmTarget::ImportedGetFullPath(const std::string& config, bool pimplib) const
{ {
return cmSystemTools::GetFilenameName( assert(this->IsImported());
this->ImportedGetFullPath(config, implib));
// Lookup/compute/cache the import information for this
// configuration.
std::string config_upper;
if(!config.empty())
{
config_upper = cmSystemTools::UpperCase(config);
}
else
{
config_upper = "NOCONFIG";
} }
//----------------------------------------------------------------------------
std::string
cmTarget::ImportedGetFullPath(const std::string& config, bool implib) const
{
std::string result; std::string result;
if(cmTarget::ImportInfo const* info = this->GetImportInfo(config))
const char* loc = 0;
const char* imp = 0;
std::string suffix;
if(this->GetType() != cmState::INTERFACE_LIBRARY
&& this->GetMappedConfig(config_upper, &loc, &imp, suffix))
{ {
result = implib? info->ImportLibrary : info->Location; if (!pimplib)
{
if(loc)
{
result = loc;
} }
else
{
std::string impProp = "IMPORTED_LOCATION";
impProp += suffix;
if(const char* config_location = this->GetProperty(impProp))
{
result = config_location;
}
else if(const char* location =
this->GetProperty("IMPORTED_LOCATION"))
{
result = location;
}
}
}
else
{
if(imp)
{
result = imp;
}
else if(this->GetType() == cmState::SHARED_LIBRARY ||
this->IsExecutableWithExports())
{
std::string impProp = "IMPORTED_IMPLIB";
impProp += suffix;
if(const char* config_implib = this->GetProperty(impProp))
{
result = config_implib;
}
else if(const char* implib = this->GetProperty("IMPORTED_IMPLIB"))
{
result = implib;
}
}
}
}
if(result.empty()) if(result.empty())
{ {
result = this->GetName(); result = this->GetName();
@ -2123,23 +2072,6 @@ cmTarget::ImportedGetFullPath(const std::string& config, bool implib) const
return result; return result;
} }
//----------------------------------------------------------------------------
void cmTarget::ComputeVersionedName(std::string& vName,
std::string const& prefix,
std::string const& base,
std::string const& suffix,
std::string const& name,
const char* version) const
{
vName = this->IsApple? (prefix+base) : name;
if(version)
{
vName += ".";
vName += version;
}
vName += this->IsApple? suffix : std::string();
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void cmTarget::SetPropertyDefault(const std::string& property, void cmTarget::SetPropertyDefault(const std::string& property,
const char* default_value) const char* default_value)
@ -2203,92 +2135,6 @@ const char* cmTarget::GetExportMacro() const
} }
} }
//----------------------------------------------------------------------------
void
cmTarget::GetObjectLibrariesCMP0026(std::vector<cmTarget*>& objlibs) const
{
// At configure-time, this method can be called as part of getting the
// LOCATION property or to export() a file to be include()d. However
// there is no cmGeneratorTarget at configure-time, so search the SOURCES
// for TARGET_OBJECTS instead for backwards compatibility with OLD
// behavior of CMP0024 and CMP0026 only.
for(std::vector<std::string>::const_iterator
i = this->Internal->SourceEntries.begin();
i != this->Internal->SourceEntries.end(); ++i)
{
std::string const& entry = *i;
std::vector<std::string> files;
cmSystemTools::ExpandListArgument(entry, files);
for (std::vector<std::string>::const_iterator
li = files.begin(); li != files.end(); ++li)
{
if(cmHasLiteralPrefix(*li, "$<TARGET_OBJECTS:") &&
(*li)[li->size() - 1] == '>')
{
std::string objLibName = li->substr(17, li->size()-18);
if (cmGeneratorExpression::Find(objLibName) != std::string::npos)
{
continue;
}
cmTarget *objLib = this->Makefile->FindTargetToUse(objLibName);
if(objLib)
{
objlibs.push_back(objLib);
}
}
}
}
}
//----------------------------------------------------------------------------
cmTarget::ImportInfo const*
cmTarget::GetImportInfo(const std::string& config) const
{
// There is no imported information for non-imported targets.
if(!this->IsImported())
{
return 0;
}
// Lookup/compute/cache the import information for this
// configuration.
std::string config_upper;
if(!config.empty())
{
config_upper = cmSystemTools::UpperCase(config);
}
else
{
config_upper = "NOCONFIG";
}
ImportInfoMapType::const_iterator i =
this->ImportInfoMap.find(config_upper);
if(i == this->ImportInfoMap.end())
{
ImportInfo info;
this->ComputeImportInfo(config_upper, info);
ImportInfoMapType::value_type entry(config_upper, info);
i = this->ImportInfoMap.insert(entry).first;
}
if(this->GetType() == cmState::INTERFACE_LIBRARY)
{
return &i->second;
}
// If the location is empty then the target is not available for
// this configuration.
if(i->second.Location.empty() && i->second.ImportLibrary.empty())
{
return 0;
}
// Return the import information.
return &i->second;
}
bool cmTarget::GetMappedConfig(std::string const& desired_config, bool cmTarget::GetMappedConfig(std::string const& desired_config,
const char** loc, const char** loc,
const char** imp, const char** imp,
@ -2420,233 +2266,6 @@ bool cmTarget::GetMappedConfig(std::string const& desired_config,
return true; return true;
} }
//----------------------------------------------------------------------------
void cmTarget::ComputeImportInfo(std::string const& desired_config,
ImportInfo& info) const
{
// This method finds information about an imported target from its
// properties. The "IMPORTED_" namespace is reserved for properties
// defined by the project exporting the target.
// Initialize members.
info.NoSOName = false;
const char* loc = 0;
const char* imp = 0;
std::string suffix;
if (!this->GetMappedConfig(desired_config, &loc, &imp, suffix))
{
return;
}
// Get the link interface.
{
std::string linkProp = "INTERFACE_LINK_LIBRARIES";
const char *propertyLibs = this->GetProperty(linkProp);
if (this->GetType() != cmState::INTERFACE_LIBRARY)
{
if(!propertyLibs)
{
linkProp = "IMPORTED_LINK_INTERFACE_LIBRARIES";
linkProp += suffix;
propertyLibs = this->GetProperty(linkProp);
}
if(!propertyLibs)
{
linkProp = "IMPORTED_LINK_INTERFACE_LIBRARIES";
propertyLibs = this->GetProperty(linkProp);
}
}
if(propertyLibs)
{
info.LibrariesProp = linkProp;
info.Libraries = propertyLibs;
}
}
if(this->GetType() == cmState::INTERFACE_LIBRARY)
{
return;
}
// A provided configuration has been chosen. Load the
// configuration's properties.
// Get the location.
if(loc)
{
info.Location = loc;
}
else
{
std::string impProp = "IMPORTED_LOCATION";
impProp += suffix;
if(const char* config_location = this->GetProperty(impProp))
{
info.Location = config_location;
}
else if(const char* location = this->GetProperty("IMPORTED_LOCATION"))
{
info.Location = location;
}
}
// Get the soname.
if(this->GetType() == cmState::SHARED_LIBRARY)
{
std::string soProp = "IMPORTED_SONAME";
soProp += suffix;
if(const char* config_soname = this->GetProperty(soProp))
{
info.SOName = config_soname;
}
else if(const char* soname = this->GetProperty("IMPORTED_SONAME"))
{
info.SOName = soname;
}
}
// Get the "no-soname" mark.
if(this->GetType() == cmState::SHARED_LIBRARY)
{
std::string soProp = "IMPORTED_NO_SONAME";
soProp += suffix;
if(const char* config_no_soname = this->GetProperty(soProp))
{
info.NoSOName = cmSystemTools::IsOn(config_no_soname);
}
else if(const char* no_soname = this->GetProperty("IMPORTED_NO_SONAME"))
{
info.NoSOName = cmSystemTools::IsOn(no_soname);
}
}
// Get the import library.
if(imp)
{
info.ImportLibrary = imp;
}
else if(this->GetType() == cmState::SHARED_LIBRARY ||
this->IsExecutableWithExports())
{
std::string impProp = "IMPORTED_IMPLIB";
impProp += suffix;
if(const char* config_implib = this->GetProperty(impProp))
{
info.ImportLibrary = config_implib;
}
else if(const char* implib = this->GetProperty("IMPORTED_IMPLIB"))
{
info.ImportLibrary = implib;
}
}
// Get the link dependencies.
{
std::string linkProp = "IMPORTED_LINK_DEPENDENT_LIBRARIES";
linkProp += suffix;
if(const char* config_libs = this->GetProperty(linkProp))
{
info.SharedDeps = config_libs;
}
else if(const char* libs =
this->GetProperty("IMPORTED_LINK_DEPENDENT_LIBRARIES"))
{
info.SharedDeps = libs;
}
}
// Get the link languages.
if(this->LinkLanguagePropagatesToDependents())
{
std::string linkProp = "IMPORTED_LINK_INTERFACE_LANGUAGES";
linkProp += suffix;
if(const char* config_libs = this->GetProperty(linkProp))
{
info.Languages = config_libs;
}
else if(const char* libs =
this->GetProperty("IMPORTED_LINK_INTERFACE_LANGUAGES"))
{
info.Languages = libs;
}
}
// Get the cyclic repetition count.
if(this->GetType() == cmState::STATIC_LIBRARY)
{
std::string linkProp = "IMPORTED_LINK_INTERFACE_MULTIPLICITY";
linkProp += suffix;
if(const char* config_reps = this->GetProperty(linkProp))
{
sscanf(config_reps, "%u", &info.Multiplicity);
}
else if(const char* reps =
this->GetProperty("IMPORTED_LINK_INTERFACE_MULTIPLICITY"))
{
sscanf(reps, "%u", &info.Multiplicity);
}
}
}
//----------------------------------------------------------------------------
std::string cmTarget::CheckCMP0004(std::string const& item) const
{
// Strip whitespace off the library names because we used to do this
// in case variables were expanded at generate time. We no longer
// do the expansion but users link to libraries like " ${VAR} ".
std::string lib = item;
std::string::size_type pos = lib.find_first_not_of(" \t\r\n");
if(pos != lib.npos)
{
lib = lib.substr(pos, lib.npos);
}
pos = lib.find_last_not_of(" \t\r\n");
if(pos != lib.npos)
{
lib = lib.substr(0, pos+1);
}
if(lib != item)
{
cmake* cm = this->Makefile->GetCMakeInstance();
switch(this->GetPolicyStatusCMP0004())
{
case cmPolicies::WARN:
{
std::ostringstream w;
w << cmPolicies::GetPolicyWarning(cmPolicies::CMP0004) << "\n"
<< "Target \"" << this->GetName() << "\" links to item \""
<< item << "\" which has leading or trailing whitespace.";
cm->IssueMessage(cmake::AUTHOR_WARNING, w.str(),
this->GetBacktrace());
}
case cmPolicies::OLD:
break;
case cmPolicies::NEW:
{
std::ostringstream e;
e << "Target \"" << this->GetName() << "\" links to item \""
<< item << "\" which has leading or trailing whitespace. "
<< "This is now an error according to policy CMP0004.";
cm->IssueMessage(cmake::FATAL_ERROR, e.str(), this->GetBacktrace());
}
break;
case cmPolicies::REQUIRED_IF_USED:
case cmPolicies::REQUIRED_ALWAYS:
{
std::ostringstream e;
e << cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0004) << "\n"
<< "Target \"" << this->GetName() << "\" links to item \""
<< item << "\" which has leading or trailing whitespace.";
cm->IssueMessage(cmake::FATAL_ERROR, e.str(), this->GetBacktrace());
}
break;
}
}
return lib;
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
cmTargetInternalPointer::cmTargetInternalPointer() cmTargetInternalPointer::cmTargetInternalPointer()
{ {

View File

@ -96,7 +96,6 @@ public:
///! Set/Get the name of the target ///! Set/Get the name of the target
const std::string& GetName() const {return this->Name;} const std::string& GetName() const {return this->Name;}
std::string GetExportName() const;
///! Set the cmMakefile that owns this target ///! Set the cmMakefile that owns this target
void SetMakefile(cmMakefile *mf); void SetMakefile(cmMakefile *mf);
@ -213,25 +212,6 @@ public:
bool IsImported() const {return this->IsImportedTarget;} bool IsImported() const {return this->IsImportedTarget;}
void GetObjectLibrariesCMP0026(std::vector<cmTarget*>& objlibs) const;
/** Strip off leading and trailing whitespace from an item named in
the link dependencies of this target. */
std::string CheckCMP0004(std::string const& item) const;
const char* ImportedGetLocation(const std::string& config) const;
/** Get the target major and minor version numbers interpreted from
the VERSION property. Version 0 is returned if the property is
not set or cannot be parsed. */
void GetTargetVersion(int& major, int& minor) const;
/** Get the target major, minor, and patch version numbers
interpreted from the VERSION or SOVERSION property. Version 0
is returned if the property is not set or cannot be parsed. */
void
GetTargetVersion(bool soversion, int& major, int& minor, int& patch) const;
// Get the properties // Get the properties
cmPropertyMap &GetProperties() const { return this->Properties; } cmPropertyMap &GetProperties() const { return this->Properties; }
@ -248,9 +228,6 @@ public:
enabled. */ enabled. */
bool IsExecutableWithExports() const; bool IsExecutableWithExports() const;
/** Return whether this target may be used to link another target. */
bool IsLinkable() const;
/** Return whether or not the target is for a DLL platform. */ /** Return whether or not the target is for a DLL platform. */
bool IsDLLPlatform() const { return this->DLLPlatform; } bool IsDLLPlatform() const { return this->DLLPlatform; }
@ -258,12 +235,6 @@ public:
Apple. */ Apple. */
bool IsFrameworkOnApple() const; bool IsFrameworkOnApple() const;
/** Return whether this target is a CFBundle (plugin) on Apple. */
bool IsCFBundleOnApple() const;
/** Return whether this target is a XCTest on Apple. */
bool IsXCTestOnApple() const;
/** Return whether this target is an executable Bundle on Apple. */ /** Return whether this target is an executable Bundle on Apple. */
bool IsAppBundleOnApple() const; bool IsAppBundleOnApple() const;
@ -385,9 +356,6 @@ private:
void SetPropertyDefault(const std::string& property, void SetPropertyDefault(const std::string& property,
const char* default_value); const char* default_value);
std::string GetFullNameImported(const std::string& config,
bool implib) const;
std::string ImportedGetFullPath(const std::string& config, std::string ImportedGetFullPath(const std::string& config,
bool implib) const; bool implib) const;
@ -426,32 +394,8 @@ private:
bool LinkLibrariesForVS6Analyzed; bool LinkLibrariesForVS6Analyzed;
#endif #endif
// Cache import information from properties for each configuration.
struct ImportInfo
{
ImportInfo(): NoSOName(false), Multiplicity(0) {}
bool NoSOName;
int Multiplicity;
std::string Location;
std::string SOName;
std::string ImportLibrary;
std::string Languages;
std::string Libraries;
std::string LibrariesProp;
std::string SharedDeps;
};
typedef std::map<std::string, ImportInfo> ImportInfoMapType;
mutable ImportInfoMapType ImportInfoMap;
ImportInfo const* GetImportInfo(const std::string& config) const;
void ComputeImportInfo(std::string const& desired_config,
ImportInfo& info) const;
std::string ProcessSourceItemCMP0049(const std::string& s); std::string ProcessSourceItemCMP0049(const std::string& s);
void MaybeInvalidatePropertyCache(const std::string& prop);
/** Return whether or not the target has a DLL import library. */ /** Return whether or not the target has a DLL import library. */
bool HasImportLibrary() const; bool HasImportLibrary() const;
@ -460,13 +404,6 @@ private:
friend class cmGeneratorTarget; friend class cmGeneratorTarget;
friend class cmTargetTraceDependencies; friend class cmTargetTraceDependencies;
void ComputeVersionedName(std::string& vName,
std::string const& prefix,
std::string const& base,
std::string const& suffix,
std::string const& name,
const char* version) const;
cmListFileBacktrace Backtrace; cmListFileBacktrace Backtrace;
}; };

View File

@ -14,7 +14,7 @@
#include "cmStandardIncludes.h" #include "cmStandardIncludes.h"
class cmTarget; class cmGeneratorTarget;
class cmInstallTargetGenerator; class cmInstallTargetGenerator;
class cmInstallFilesGenerator; class cmInstallFilesGenerator;
@ -25,7 +25,8 @@ class cmInstallFilesGenerator;
class cmTargetExport class cmTargetExport
{ {
public: public:
cmTarget* Target; ///< The target std::string TargetName;
cmGeneratorTarget* Target;
///@name Generators ///@name Generators
///@{ ///@{

View File

@ -178,7 +178,7 @@ cmVisualStudio10TargetGenerator(cmTarget* target,
this->LocalGenerator = this->LocalGenerator =
(cmLocalVisualStudio7Generator*) (cmLocalVisualStudio7Generator*)
this->GeneratorTarget->GetLocalGenerator(); this->GeneratorTarget->GetLocalGenerator();
this->Name = this->Target->GetName(); this->Name = this->GeneratorTarget->GetName();
this->GUID = this->GlobalGenerator->GetGUID(this->Name.c_str()); this->GUID = this->GlobalGenerator->GetGUID(this->Name.c_str());
this->Platform = gg->GetPlatformName(); this->Platform = gg->GetPlatformName();
this->NsightTegra = gg->IsNsightTegra(); this->NsightTegra = gg->IsNsightTegra();
@ -270,7 +270,7 @@ void cmVisualStudio10TargetGenerator::Generate()
{ {
// do not generate external ms projects // do not generate external ms projects
if(this->GeneratorTarget->GetType() == cmState::INTERFACE_LIBRARY if(this->GeneratorTarget->GetType() == cmState::INTERFACE_LIBRARY
|| this->Target->GetProperty("EXTERNAL_MSPROJECT")) || this->GeneratorTarget->GetProperty("EXTERNAL_MSPROJECT"))
{ {
return; return;
} }
@ -368,7 +368,7 @@ void cmVisualStudio10TargetGenerator::Generate()
} }
const char* vsProjectTypes = const char* vsProjectTypes =
this->Target->GetProperty("VS_GLOBAL_PROJECT_TYPES"); this->GeneratorTarget->GetProperty("VS_GLOBAL_PROJECT_TYPES");
if(vsProjectTypes) if(vsProjectTypes)
{ {
this->WriteString("<ProjectTypes>", 2); this->WriteString("<ProjectTypes>", 2);
@ -376,9 +376,12 @@ void cmVisualStudio10TargetGenerator::Generate()
"</ProjectTypes>\n"; "</ProjectTypes>\n";
} }
const char* vsProjectName = this->Target->GetProperty("VS_SCC_PROJECTNAME"); const char* vsProjectName =
const char* vsLocalPath = this->Target->GetProperty("VS_SCC_LOCALPATH"); this->GeneratorTarget->GetProperty("VS_SCC_PROJECTNAME");
const char* vsProvider = this->Target->GetProperty("VS_SCC_PROVIDER"); const char* vsLocalPath =
this->GeneratorTarget->GetProperty("VS_SCC_LOCALPATH");
const char* vsProvider =
this->GeneratorTarget->GetProperty("VS_SCC_PROVIDER");
if( vsProjectName && vsLocalPath && vsProvider ) if( vsProjectName && vsLocalPath && vsProvider )
{ {
@ -392,7 +395,8 @@ void cmVisualStudio10TargetGenerator::Generate()
(*this->BuildFileStream) << cmVS10EscapeXML(vsProvider) << (*this->BuildFileStream) << cmVS10EscapeXML(vsProvider) <<
"</SccProvider>\n"; "</SccProvider>\n";
const char* vsAuxPath = this->Target->GetProperty("VS_SCC_AUXPATH"); const char* vsAuxPath =
this->GeneratorTarget->GetProperty("VS_SCC_AUXPATH");
if( vsAuxPath ) if( vsAuxPath )
{ {
this->WriteString("<SccAuxPath>", 2); this->WriteString("<SccAuxPath>", 2);
@ -401,13 +405,13 @@ void cmVisualStudio10TargetGenerator::Generate()
} }
} }
if(this->Target->GetPropertyAsBool("VS_WINRT_COMPONENT")) if(this->GeneratorTarget->GetPropertyAsBool("VS_WINRT_COMPONENT"))
{ {
this->WriteString("<WinMDAssembly>true</WinMDAssembly>\n", 2); this->WriteString("<WinMDAssembly>true</WinMDAssembly>\n", 2);
} }
const char* vsGlobalKeyword = const char* vsGlobalKeyword =
this->Target->GetProperty("VS_GLOBAL_KEYWORD"); this->GeneratorTarget->GetProperty("VS_GLOBAL_KEYWORD");
if(!vsGlobalKeyword) if(!vsGlobalKeyword)
{ {
this->WriteString("<Keyword>Win32Proj</Keyword>\n", 2); this->WriteString("<Keyword>Win32Proj</Keyword>\n", 2);
@ -420,7 +424,7 @@ void cmVisualStudio10TargetGenerator::Generate()
} }
const char* vsGlobalRootNamespace = const char* vsGlobalRootNamespace =
this->Target->GetProperty("VS_GLOBAL_ROOTNAMESPACE"); this->GeneratorTarget->GetProperty("VS_GLOBAL_ROOTNAMESPACE");
if(vsGlobalRootNamespace) if(vsGlobalRootNamespace)
{ {
this->WriteString("<RootNamespace>", 2); this->WriteString("<RootNamespace>", 2);
@ -431,14 +435,14 @@ void cmVisualStudio10TargetGenerator::Generate()
this->WriteString("<Platform>", 2); this->WriteString("<Platform>", 2);
(*this->BuildFileStream) << cmVS10EscapeXML(this->Platform) (*this->BuildFileStream) << cmVS10EscapeXML(this->Platform)
<< "</Platform>\n"; << "</Platform>\n";
const char* projLabel = this->Target->GetProperty("PROJECT_LABEL"); const char* projLabel = this->GeneratorTarget->GetProperty("PROJECT_LABEL");
if(!projLabel) if(!projLabel)
{ {
projLabel = this->Name.c_str(); projLabel = this->Name.c_str();
} }
this->WriteString("<ProjectName>", 2); this->WriteString("<ProjectName>", 2);
(*this->BuildFileStream) << cmVS10EscapeXML(projLabel) << "</ProjectName>\n"; (*this->BuildFileStream) << cmVS10EscapeXML(projLabel) << "</ProjectName>\n";
if(const char* targetFrameworkVersion = this->Target->GetProperty( if(const char* targetFrameworkVersion = this->GeneratorTarget->GetProperty(
"VS_DOTNET_TARGET_FRAMEWORK_VERSION")) "VS_DOTNET_TARGET_FRAMEWORK_VERSION"))
{ {
this->WriteString("<TargetFrameworkVersion>", 2); this->WriteString("<TargetFrameworkVersion>", 2);
@ -497,7 +501,7 @@ void cmVisualStudio10TargetGenerator::WriteDotNetReferences()
{ {
std::vector<std::string> references; std::vector<std::string> references;
if(const char* vsDotNetReferences = if(const char* vsDotNetReferences =
this->Target->GetProperty("VS_DOTNET_REFERENCES")) this->GeneratorTarget->GetProperty("VS_DOTNET_REFERENCES"))
{ {
cmSystemTools::ExpandListArgument(vsDotNetReferences, references); cmSystemTools::ExpandListArgument(vsDotNetReferences, references);
} }
@ -543,7 +547,7 @@ void cmVisualStudio10TargetGenerator::WriteEmbeddedResourceGroup()
i != this->Configurations.end(); ++i) i != this->Configurations.end(); ++i)
{ {
this->WritePlatformConfigTag("LogicalName", i->c_str(), 3); this->WritePlatformConfigTag("LogicalName", i->c_str(), 3);
if(this->Target->GetProperty("VS_GLOBAL_ROOTNAMESPACE")) if(this->GeneratorTarget->GetProperty("VS_GLOBAL_ROOTNAMESPACE"))
{ {
(*this->BuildFileStream ) << "$(RootNamespace)."; (*this->BuildFileStream ) << "$(RootNamespace).";
} }
@ -610,7 +614,7 @@ void cmVisualStudio10TargetGenerator::WriteWinRTReferences()
{ {
std::vector<std::string> references; std::vector<std::string> references;
if(const char* vsWinRTReferences = if(const char* vsWinRTReferences =
this->Target->GetProperty("VS_WINRT_REFERENCES")) this->GeneratorTarget->GetProperty("VS_WINRT_REFERENCES"))
{ {
cmSystemTools::ExpandListArgument(vsWinRTReferences, references); cmSystemTools::ExpandListArgument(vsWinRTReferences, references);
} }
@ -679,7 +683,7 @@ void cmVisualStudio10TargetGenerator::WriteProjectConfigurationValues()
break; break;
case cmState::EXECUTABLE: case cmState::EXECUTABLE:
if(this->NsightTegra && if(this->NsightTegra &&
!this->Target->GetPropertyAsBool("ANDROID_GUI")) !this->GeneratorTarget->GetPropertyAsBool("ANDROID_GUI"))
{ {
// Android executables are .so too. // Android executables are .so too.
configType += "DynamicLibrary"; configType += "DynamicLibrary";
@ -746,10 +750,10 @@ void cmVisualStudio10TargetGenerator
if((this->GeneratorTarget->GetType() <= cmState::OBJECT_LIBRARY && if((this->GeneratorTarget->GetType() <= cmState::OBJECT_LIBRARY &&
this->ClOptions[config]->UsingUnicode()) || this->ClOptions[config]->UsingUnicode()) ||
this->Target->GetPropertyAsBool("VS_WINRT_COMPONENT") || this->GeneratorTarget->GetPropertyAsBool("VS_WINRT_COMPONENT") ||
this->GlobalGenerator->TargetsWindowsPhone() || this->GlobalGenerator->TargetsWindowsPhone() ||
this->GlobalGenerator->TargetsWindowsStore() || this->GlobalGenerator->TargetsWindowsStore() ||
this->Target->GetPropertyAsBool("VS_WINRT_EXTENSIONS")) this->GeneratorTarget->GetPropertyAsBool("VS_WINRT_EXTENSIONS"))
{ {
this->WriteString("<CharacterSet>Unicode</CharacterSet>\n", 2); this->WriteString("<CharacterSet>Unicode</CharacterSet>\n", 2);
} }
@ -769,8 +773,8 @@ void cmVisualStudio10TargetGenerator
pts += "</PlatformToolset>\n"; pts += "</PlatformToolset>\n";
this->WriteString(pts.c_str(), 2); this->WriteString(pts.c_str(), 2);
} }
if(this->Target->GetPropertyAsBool("VS_WINRT_COMPONENT") || if(this->GeneratorTarget->GetPropertyAsBool("VS_WINRT_COMPONENT") ||
this->Target->GetPropertyAsBool("VS_WINRT_EXTENSIONS")) this->GeneratorTarget->GetPropertyAsBool("VS_WINRT_EXTENSIONS"))
{ {
this->WriteString("<WindowsAppContainer>true" this->WriteString("<WindowsAppContainer>true"
"</WindowsAppContainer>\n", 2); "</WindowsAppContainer>\n", 2);
@ -788,27 +792,29 @@ void cmVisualStudio10TargetGenerator
ntv += toolset? toolset : "Default"; ntv += toolset? toolset : "Default";
ntv += "</NdkToolchainVersion>\n"; ntv += "</NdkToolchainVersion>\n";
this->WriteString(ntv.c_str(), 2); this->WriteString(ntv.c_str(), 2);
if(const char* minApi = this->Target->GetProperty("ANDROID_API_MIN")) if(const char* minApi =
this->GeneratorTarget->GetProperty("ANDROID_API_MIN"))
{ {
this->WriteString("<AndroidMinAPI>", 2); this->WriteString("<AndroidMinAPI>", 2);
(*this->BuildFileStream ) << (*this->BuildFileStream ) <<
"android-" << cmVS10EscapeXML(minApi) << "</AndroidMinAPI>\n"; "android-" << cmVS10EscapeXML(minApi) << "</AndroidMinAPI>\n";
} }
if(const char* api = this->Target->GetProperty("ANDROID_API")) if(const char* api = this->GeneratorTarget->GetProperty("ANDROID_API"))
{ {
this->WriteString("<AndroidTargetAPI>", 2); this->WriteString("<AndroidTargetAPI>", 2);
(*this->BuildFileStream ) << (*this->BuildFileStream ) <<
"android-" << cmVS10EscapeXML(api) << "</AndroidTargetAPI>\n"; "android-" << cmVS10EscapeXML(api) << "</AndroidTargetAPI>\n";
} }
if(const char* cpuArch = this->Target->GetProperty("ANDROID_ARCH")) if(const char* cpuArch = this->GeneratorTarget->GetProperty("ANDROID_ARCH"))
{ {
this->WriteString("<AndroidArch>", 2); this->WriteString("<AndroidArch>", 2);
(*this->BuildFileStream) << cmVS10EscapeXML(cpuArch) << (*this->BuildFileStream) << cmVS10EscapeXML(cpuArch) <<
"</AndroidArch>\n"; "</AndroidArch>\n";
} }
if(const char* stlType = this->Target->GetProperty("ANDROID_STL_TYPE")) if(const char* stlType =
this->GeneratorTarget->GetProperty("ANDROID_STL_TYPE"))
{ {
this->WriteString("<AndroidStlType>", 2); this->WriteString("<AndroidStlType>", 2);
(*this->BuildFileStream) << cmVS10EscapeXML(stlType) << (*this->BuildFileStream) << cmVS10EscapeXML(stlType) <<
@ -1775,7 +1781,7 @@ void cmVisualStudio10TargetGenerator::WritePathAndIncrementalLinkOptions()
if(ttype == cmState::OBJECT_LIBRARY) if(ttype == cmState::OBJECT_LIBRARY)
{ {
outDir = intermediateDir; outDir = intermediateDir;
targetNameFull = this->Target->GetName(); targetNameFull = this->GeneratorTarget->GetName();
targetNameFull += ".lib"; targetNameFull += ".lib";
} }
else else
@ -1926,7 +1932,7 @@ bool cmVisualStudio10TargetGenerator::ComputeClOptions(
{ {
clOptions.AddFlag("CompileAs", "CompileAsCpp"); clOptions.AddFlag("CompileAs", "CompileAsCpp");
} }
this->LocalGenerator->AddCompileOptions(flags, this->Target, this->LocalGenerator->AddCompileOptions(flags, this->GeneratorTarget,
linkLanguage, configName.c_str()); linkLanguage, configName.c_str());
// Get preprocessor definitions for this directory. // Get preprocessor definitions for this directory.
@ -1963,7 +1969,7 @@ bool cmVisualStudio10TargetGenerator::ComputeClOptions(
if (this->MSTools) if (this->MSTools)
{ {
// If we have the VS_WINRT_COMPONENT set then force Compile as WinRT. // If we have the VS_WINRT_COMPONENT set then force Compile as WinRT.
if (this->Target->GetPropertyAsBool("VS_WINRT_COMPONENT")) if (this->GeneratorTarget->GetPropertyAsBool("VS_WINRT_COMPONENT"))
{ {
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
@ -2012,7 +2018,7 @@ void cmVisualStudio10TargetGenerator::WriteClOptions(
if(this->NsightTegra) if(this->NsightTegra)
{ {
if(const char* processMax = if(const char* processMax =
this->Target->GetProperty("ANDROID_PROCESS_MAX")) this->GeneratorTarget->GetProperty("ANDROID_PROCESS_MAX"))
{ {
this->WriteString("<ProcessMax>", 3); this->WriteString("<ProcessMax>", 3);
*this->BuildFileStream << cmVS10EscapeXML(processMax) << *this->BuildFileStream << cmVS10EscapeXML(processMax) <<
@ -2183,7 +2189,7 @@ cmVisualStudio10TargetGenerator::WriteLibOptions(std::string const& config)
} }
std::string libflags; std::string libflags;
this->LocalGenerator->GetStaticLibraryFlags(libflags, this->LocalGenerator->GetStaticLibraryFlags(libflags,
cmSystemTools::UpperCase(config), this->Target); cmSystemTools::UpperCase(config), this->GeneratorTarget);
if(!libflags.empty()) if(!libflags.empty())
{ {
this->WriteString("<Lib>\n", 2); this->WriteString("<Lib>\n", 2);
@ -2270,18 +2276,18 @@ void cmVisualStudio10TargetGenerator::WriteAntBuildOptions(
cmVS10EscapeXML(antBuildPath) << "</AntBuildPath>\n"; cmVS10EscapeXML(antBuildPath) << "</AntBuildPath>\n";
} }
if (this->Target->GetPropertyAsBool("ANDROID_SKIP_ANT_STEP")) if (this->GeneratorTarget->GetPropertyAsBool("ANDROID_SKIP_ANT_STEP"))
{ {
this->WriteString("<SkipAntStep>true</SkipAntStep>\n", 3); this->WriteString("<SkipAntStep>true</SkipAntStep>\n", 3);
} }
if (this->Target->GetPropertyAsBool("ANDROID_PROGUARD")) if (this->GeneratorTarget->GetPropertyAsBool("ANDROID_PROGUARD"))
{ {
this->WriteString("<EnableProGuard>true</EnableProGuard>\n", 3); this->WriteString("<EnableProGuard>true</EnableProGuard>\n", 3);
} }
if (const char* proGuardConfigLocation = if (const char* proGuardConfigLocation =
this->Target->GetProperty("ANDROID_PROGUARD_CONFIG_PATH")) this->GeneratorTarget->GetProperty("ANDROID_PROGUARD_CONFIG_PATH"))
{ {
this->WriteString("<ProGuardConfigLocation>", 3); this->WriteString("<ProGuardConfigLocation>", 3);
(*this->BuildFileStream) << cmVS10EscapeXML(proGuardConfigLocation) << (*this->BuildFileStream) << cmVS10EscapeXML(proGuardConfigLocation) <<
@ -2289,7 +2295,7 @@ void cmVisualStudio10TargetGenerator::WriteAntBuildOptions(
} }
if (const char* securePropertiesLocation = if (const char* securePropertiesLocation =
this->Target->GetProperty("ANDROID_SECURE_PROPS_PATH")) this->GeneratorTarget->GetProperty("ANDROID_SECURE_PROPS_PATH"))
{ {
this->WriteString("<SecurePropertiesLocation>", 3); this->WriteString("<SecurePropertiesLocation>", 3);
(*this->BuildFileStream) << cmVS10EscapeXML(securePropertiesLocation) << (*this->BuildFileStream) << cmVS10EscapeXML(securePropertiesLocation) <<
@ -2297,7 +2303,7 @@ void cmVisualStudio10TargetGenerator::WriteAntBuildOptions(
} }
if (const char* nativeLibDirectoriesExpression = if (const char* nativeLibDirectoriesExpression =
this->Target->GetProperty("ANDROID_NATIVE_LIB_DIRECTORIES")) this->GeneratorTarget->GetProperty("ANDROID_NATIVE_LIB_DIRECTORIES"))
{ {
cmGeneratorExpression ge; cmGeneratorExpression ge;
cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = cmsys::auto_ptr<cmCompiledGeneratorExpression> cge =
@ -2310,7 +2316,7 @@ void cmVisualStudio10TargetGenerator::WriteAntBuildOptions(
} }
if (const char* nativeLibDependenciesExpression = if (const char* nativeLibDependenciesExpression =
this->Target->GetProperty("ANDROID_NATIVE_LIB_DEPENDENCIES")) this->GeneratorTarget->GetProperty("ANDROID_NATIVE_LIB_DEPENDENCIES"))
{ {
cmGeneratorExpression ge; cmGeneratorExpression ge;
cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = cmsys::auto_ptr<cmCompiledGeneratorExpression> cge =
@ -2323,7 +2329,7 @@ void cmVisualStudio10TargetGenerator::WriteAntBuildOptions(
} }
if (const char* javaSourceDir = if (const char* javaSourceDir =
this->Target->GetProperty("ANDROID_JAVA_SOURCE_DIR")) this->GeneratorTarget->GetProperty("ANDROID_JAVA_SOURCE_DIR"))
{ {
this->WriteString("<JavaSourceDir>", 3); this->WriteString("<JavaSourceDir>", 3);
(*this->BuildFileStream) << cmVS10EscapeXML(javaSourceDir) << (*this->BuildFileStream) << cmVS10EscapeXML(javaSourceDir) <<
@ -2331,7 +2337,7 @@ void cmVisualStudio10TargetGenerator::WriteAntBuildOptions(
} }
if (const char* jarDirectoriesExpression = if (const char* jarDirectoriesExpression =
this->Target->GetProperty("ANDROID_JAR_DIRECTORIES")) this->GeneratorTarget->GetProperty("ANDROID_JAR_DIRECTORIES"))
{ {
cmGeneratorExpression ge; cmGeneratorExpression ge;
cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = cmsys::auto_ptr<cmCompiledGeneratorExpression> cge =
@ -2344,7 +2350,7 @@ void cmVisualStudio10TargetGenerator::WriteAntBuildOptions(
} }
if (const char* jarDeps = if (const char* jarDeps =
this->Target->GetProperty("ANDROID_JAR_DEPENDENCIES")) this->GeneratorTarget->GetProperty("ANDROID_JAR_DEPENDENCIES"))
{ {
this->WriteString("<JarDependencies>", 3); this->WriteString("<JarDependencies>", 3);
(*this->BuildFileStream) << cmVS10EscapeXML(jarDeps) << (*this->BuildFileStream) << cmVS10EscapeXML(jarDeps) <<
@ -2352,7 +2358,7 @@ void cmVisualStudio10TargetGenerator::WriteAntBuildOptions(
} }
if (const char* assetsDirectories = if (const char* assetsDirectories =
this->Target->GetProperty("ANDROID_ASSETS_DIRECTORIES")) this->GeneratorTarget->GetProperty("ANDROID_ASSETS_DIRECTORIES"))
{ {
this->WriteString("<AssetsDirectories>", 3); this->WriteString("<AssetsDirectories>", 3);
(*this->BuildFileStream) << cmVS10EscapeXML(assetsDirectories) << (*this->BuildFileStream) << cmVS10EscapeXML(assetsDirectories) <<
@ -2368,7 +2374,7 @@ void cmVisualStudio10TargetGenerator::WriteAntBuildOptions(
} }
if (const char* antAdditionalOptions = if (const char* antAdditionalOptions =
this->Target->GetProperty("ANDROID_ANT_ADDITIONAL_OPTIONS")) this->GeneratorTarget->GetProperty("ANDROID_ANT_ADDITIONAL_OPTIONS"))
{ {
this->WriteString("<AdditionalOptions>", 3); this->WriteString("<AdditionalOptions>", 3);
(*this->BuildFileStream) << cmVS10EscapeXML(antAdditionalOptions) << (*this->BuildFileStream) << cmVS10EscapeXML(antAdditionalOptions) <<
@ -2439,7 +2445,8 @@ cmVisualStudio10TargetGenerator::ComputeLinkOptions(std::string const& config)
flags += " "; flags += " ";
flags += this-> flags += this->
Target->GetMakefile()->GetRequiredDefinition(linkFlagVar.c_str()); Target->GetMakefile()->GetRequiredDefinition(linkFlagVar.c_str());
const char* targetLinkFlags = this->Target->GetProperty("LINK_FLAGS"); const char* targetLinkFlags =
this->GeneratorTarget->GetProperty("LINK_FLAGS");
if(targetLinkFlags) if(targetLinkFlags)
{ {
flags += " "; flags += " ";
@ -2447,7 +2454,8 @@ cmVisualStudio10TargetGenerator::ComputeLinkOptions(std::string const& config)
} }
std::string flagsProp = "LINK_FLAGS_"; std::string flagsProp = "LINK_FLAGS_";
flagsProp += CONFIG; flagsProp += CONFIG;
if(const char* flagsConfig = this->Target->GetProperty(flagsProp.c_str())) if(const char* flagsConfig =
this->GeneratorTarget->GetProperty(flagsProp.c_str()))
{ {
flags += " "; flags += " ";
flags += flagsConfig; flags += flagsConfig;
@ -2525,7 +2533,7 @@ cmVisualStudio10TargetGenerator::ComputeLinkOptions(std::string const& config)
{ {
linkOptions.AddFlag("Version", ""); linkOptions.AddFlag("Version", "");
if ( this->Target->GetPropertyAsBool("WIN32_EXECUTABLE") ) if ( this->GeneratorTarget->GetPropertyAsBool("WIN32_EXECUTABLE") )
{ {
if (this->GlobalGenerator->TargetsWindowsCE()) if (this->GlobalGenerator->TargetsWindowsCE())
{ {
@ -2597,7 +2605,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->GeneratorTarget->GetPropertyAsBool("VS_WINRT_COMPONENT") &&
this->GeneratorTarget->GetType() != cmState::EXECUTABLE) this->GeneratorTarget->GetType() != cmState::EXECUTABLE)
{ {
linkOptions.AddFlag("GenerateWindowsMetadata", "true"); linkOptions.AddFlag("GenerateWindowsMetadata", "true");
@ -2639,7 +2647,7 @@ cmVisualStudio10TargetGenerator::ComputeLinkOptions(std::string const& config)
if (this->GeneratorTarget->GetType() == cmState::SHARED_LIBRARY && if (this->GeneratorTarget->GetType() == cmState::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->GeneratorTarget->GetPropertyAsBool("WINDOWS_EXPORT_ALL_SYMBOLS"))
{ {
linkOptions.AddFlag("ModuleDefinitionFile", "$(IntDir)exportall.def"); linkOptions.AddFlag("ModuleDefinitionFile", "$(IntDir)exportall.def");
} }
@ -2783,7 +2791,7 @@ void cmVisualStudio10TargetGenerator::WriteItemDefinitionGroups()
this->WriteManifestOptions(*i); this->WriteManifestOptions(*i);
if(this->NsightTegra && if(this->NsightTegra &&
this->GeneratorTarget->GetType() == cmState::EXECUTABLE && this->GeneratorTarget->GetType() == cmState::EXECUTABLE &&
this->Target->GetPropertyAsBool("ANDROID_GUI")) this->GeneratorTarget->GetPropertyAsBool("ANDROID_GUI"))
{ {
this->WriteAntBuildOptions(*i); this->WriteAntBuildOptions(*i);
} }
@ -2798,7 +2806,7 @@ cmVisualStudio10TargetGenerator::WriteEvents(std::string const& configName)
if (this->GeneratorTarget->GetType() == cmState::SHARED_LIBRARY && if (this->GeneratorTarget->GetType() == cmState::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->GeneratorTarget->GetPropertyAsBool("WINDOWS_EXPORT_ALL_SYMBOLS"))
{ {
addedPrelink = true; addedPrelink = true;
std::vector<cmCustomCommand> commands = std::vector<cmCustomCommand> commands =
@ -2911,14 +2919,14 @@ void cmVisualStudio10TargetGenerator::WritePlatformExtensions()
cmHasLiteralPrefix(this->GlobalGenerator->GetSystemVersion(), "10.0")) cmHasLiteralPrefix(this->GlobalGenerator->GetSystemVersion(), "10.0"))
{ {
const char* desktopExtensionsVersion = const char* desktopExtensionsVersion =
this->Target->GetProperty("VS_DESKTOP_EXTENSIONS_VERSION"); this->GeneratorTarget->GetProperty("VS_DESKTOP_EXTENSIONS_VERSION");
if (desktopExtensionsVersion) if (desktopExtensionsVersion)
{ {
this->WriteSinglePlatformExtension("WindowsDesktop", this->WriteSinglePlatformExtension("WindowsDesktop",
desktopExtensionsVersion); desktopExtensionsVersion);
} }
const char* mobileExtensionsVersion = const char* mobileExtensionsVersion =
this->Target->GetProperty("VS_MOBILE_EXTENSIONS_VERSION"); this->GeneratorTarget->GetProperty("VS_MOBILE_EXTENSIONS_VERSION");
if (mobileExtensionsVersion) if (mobileExtensionsVersion)
{ {
this->WriteSinglePlatformExtension("WindowsMobile", this->WriteSinglePlatformExtension("WindowsMobile",
@ -2958,11 +2966,11 @@ void cmVisualStudio10TargetGenerator::WriteSDKReferences()
cmHasLiteralPrefix(this->GlobalGenerator->GetSystemVersion(), "10.0")) cmHasLiteralPrefix(this->GlobalGenerator->GetSystemVersion(), "10.0"))
{ {
const char* desktopExtensionsVersion = const char* desktopExtensionsVersion =
this->Target->GetProperty("VS_DESKTOP_EXTENSIONS_VERSION"); this->GeneratorTarget->GetProperty("VS_DESKTOP_EXTENSIONS_VERSION");
const char* mobileExtensionsVersion = const char* mobileExtensionsVersion =
this->Target->GetProperty("VS_MOBILE_EXTENSIONS_VERSION"); this->GeneratorTarget->GetProperty("VS_MOBILE_EXTENSIONS_VERSION");
const char* iotExtensionsVersion = const char* iotExtensionsVersion =
this->Target->GetProperty("VS_IOT_EXTENSIONS_VERSION"); this->GeneratorTarget->GetProperty("VS_IOT_EXTENSIONS_VERSION");
if(desktopExtensionsVersion || mobileExtensionsVersion || if(desktopExtensionsVersion || mobileExtensionsVersion ||
iotExtensionsVersion) iotExtensionsVersion)
@ -3194,7 +3202,8 @@ void cmVisualStudio10TargetGenerator::WriteApplicationTypeSettings()
"</WindowsTargetPlatformVersion>\n"; "</WindowsTargetPlatformVersion>\n";
} }
const char* targetPlatformMinVersion = const char* targetPlatformMinVersion =
this->Target->GetProperty("VS_WINDOWS_TARGET_PLATFORM_MIN_VERSION"); this->GeneratorTarget
->GetProperty("VS_WINDOWS_TARGET_PLATFORM_MIN_VERSION");
if(targetPlatformMinVersion) if(targetPlatformMinVersion)
{ {
this->WriteString("<WindowsTargetPlatformMinVersion>", 2); this->WriteString("<WindowsTargetPlatformMinVersion>", 2);
@ -3213,7 +3222,7 @@ void cmVisualStudio10TargetGenerator::WriteApplicationTypeSettings()
} }
// Added IoT Startup Task support // Added IoT Startup Task support
if(this->Target->GetPropertyAsBool("VS_IOT_STARTUP_TASK")) if(this->GeneratorTarget->GetPropertyAsBool("VS_IOT_STARTUP_TASK"))
{ {
this->WriteString("<ContainsStartupTask>true</ContainsStartupTask>\n", 2); this->WriteString("<ContainsStartupTask>true</ContainsStartupTask>\n", 2);
} }
@ -3325,7 +3334,8 @@ void cmVisualStudio10TargetGenerator::WriteMissingFilesWP80()
this->LocalGenerator->GetTargetDirectory(this->GeneratorTarget); this->LocalGenerator->GetTargetDirectory(this->GeneratorTarget);
this->ConvertToWindowsSlash(artifactDir); this->ConvertToWindowsSlash(artifactDir);
std::string artifactDirXML = cmVS10EscapeXML(artifactDir); std::string artifactDirXML = cmVS10EscapeXML(artifactDir);
std::string targetNameXML = cmVS10EscapeXML(this->Target->GetName()); std::string targetNameXML =
cmVS10EscapeXML(this->GeneratorTarget->GetName());
cmGeneratedFileStream fout(manifestFile.c_str()); cmGeneratedFileStream fout(manifestFile.c_str());
fout.SetCopyIfDifferent(true); fout.SetCopyIfDifferent(true);
@ -3408,7 +3418,8 @@ void cmVisualStudio10TargetGenerator::WriteMissingFilesWP81()
this->LocalGenerator->GetTargetDirectory(this->GeneratorTarget); this->LocalGenerator->GetTargetDirectory(this->GeneratorTarget);
this->ConvertToWindowsSlash(artifactDir); this->ConvertToWindowsSlash(artifactDir);
std::string artifactDirXML = cmVS10EscapeXML(artifactDir); std::string artifactDirXML = cmVS10EscapeXML(artifactDir);
std::string targetNameXML = cmVS10EscapeXML(this->Target->GetName()); std::string targetNameXML =
cmVS10EscapeXML(this->GeneratorTarget->GetName());
cmGeneratedFileStream fout(manifestFile.c_str()); cmGeneratedFileStream fout(manifestFile.c_str());
fout.SetCopyIfDifferent(true); fout.SetCopyIfDifferent(true);
@ -3468,7 +3479,8 @@ void cmVisualStudio10TargetGenerator::WriteMissingFilesWS80()
this->LocalGenerator->GetTargetDirectory(this->GeneratorTarget); this->LocalGenerator->GetTargetDirectory(this->GeneratorTarget);
this->ConvertToWindowsSlash(artifactDir); this->ConvertToWindowsSlash(artifactDir);
std::string artifactDirXML = cmVS10EscapeXML(artifactDir); std::string artifactDirXML = cmVS10EscapeXML(artifactDir);
std::string targetNameXML = cmVS10EscapeXML(this->Target->GetName()); std::string targetNameXML =
cmVS10EscapeXML(this->GeneratorTarget->GetName());
cmGeneratedFileStream fout(manifestFile.c_str()); cmGeneratedFileStream fout(manifestFile.c_str());
fout.SetCopyIfDifferent(true); fout.SetCopyIfDifferent(true);
@ -3520,7 +3532,8 @@ void cmVisualStudio10TargetGenerator::WriteMissingFilesWS81()
this->LocalGenerator->GetTargetDirectory(this->GeneratorTarget); this->LocalGenerator->GetTargetDirectory(this->GeneratorTarget);
this->ConvertToWindowsSlash(artifactDir); this->ConvertToWindowsSlash(artifactDir);
std::string artifactDirXML = cmVS10EscapeXML(artifactDir); std::string artifactDirXML = cmVS10EscapeXML(artifactDir);
std::string targetNameXML = cmVS10EscapeXML(this->Target->GetName()); std::string targetNameXML =
cmVS10EscapeXML(this->GeneratorTarget->GetName());
cmGeneratedFileStream fout(manifestFile.c_str()); cmGeneratedFileStream fout(manifestFile.c_str());
fout.SetCopyIfDifferent(true); fout.SetCopyIfDifferent(true);
@ -3577,7 +3590,8 @@ void cmVisualStudio10TargetGenerator::WriteMissingFilesWS10_0()
this->LocalGenerator->GetTargetDirectory(this->GeneratorTarget); this->LocalGenerator->GetTargetDirectory(this->GeneratorTarget);
this->ConvertToWindowsSlash(artifactDir); this->ConvertToWindowsSlash(artifactDir);
std::string artifactDirXML = cmVS10EscapeXML(artifactDir); std::string artifactDirXML = cmVS10EscapeXML(artifactDir);
std::string targetNameXML = cmVS10EscapeXML(this->Target->GetName()); std::string targetNameXML =
cmVS10EscapeXML(this->GeneratorTarget->GetName());
cmGeneratedFileStream fout(manifestFile.c_str()); cmGeneratedFileStream fout(manifestFile.c_str());
fout.SetCopyIfDifferent(true); fout.SetCopyIfDifferent(true);