Merge topic 'use-generator-target'

79c3a2a8 cmGlobalGenerator: Remove map from cmTarget to cmGeneratorTarget
c389f8bb cmLocalGenerator: Port Find method away from GetGeneratorTarget
02533038 VS6: Port to FindGeneratorTarget
b6278e9f cmake: Port find_package mode away from GetGeneratorTarget
7a6caae1 cmMakefile: Add imported target accessor
0fb187cc CMP0026: Port away from GetGeneratorTarget
8caf1f36 cmGlobalGenerator: Add FindGeneratorTarget API
278ba2db cmGeneratorTarget: Add API for globally visible IMPORTED
79c11d23 Xcode: Port away from GetGeneratorTarget
9b244cc0 cmLocalGenerator: Store imported targets in a separate container.
def6da61 cmLocalGenerator: Port FindGeneratorTarget away from GetGeneratorTarget
a67231ac cmTarget: Implement ALIAS in terms of name mapping
d566f39a cmGlobalGenerator: Remove unneeded GetGeneratorTarget
0c97d32f cmGlobalGenerator: Remove direct storage of targets
383bfd95 cmTargetCollectLinkLanguages: Remove cmMakefile dependency
7f6bedda cmGeneratorTarget: Port cmOptionalLinkImplementation
...
This commit is contained in:
Brad King 2015-10-28 08:48:05 -04:00 committed by CMake Topic Stage
commit 1e8c920d04
49 changed files with 622 additions and 409 deletions

View File

@ -192,7 +192,7 @@ bool cmAddExecutableCommand
this->SetError(e.str()); this->SetError(e.str());
return false; return false;
} }
this->Makefile->AddAlias(exename, aliasedTarget); this->Makefile->AddAlias(exename, aliasedName);
return true; return true;
} }

View File

@ -314,7 +314,7 @@ bool cmAddLibraryCommand
this->SetError(e.str()); this->SetError(e.str());
return false; return false;
} }
this->Makefile->AddAlias(libName, aliasedTarget); this->Makefile->AddAlias(libName, aliasedName);
return true; return true;
} }

View File

@ -60,10 +60,10 @@ bool cmAuxSourceDirectoryCommand::InitialPass
std::string ext = file.substr(dotpos+1); std::string ext = file.substr(dotpos+1);
std::string base = file.substr(0, dotpos); std::string base = file.substr(0, dotpos);
// Process only source files // Process only source files
if(!base.empty() std::vector<std::string> srcExts =
&& std::find( this->Makefile->GetSourceExtensions().begin(), this->Makefile->GetCMakeInstance()->GetSourceExtensions();
this->Makefile->GetSourceExtensions().end(), ext ) if(!base.empty() &&
!= this->Makefile->GetSourceExtensions().end() ) std::find(srcExts.begin(), srcExts.end(), ext) != srcExts.end())
{ {
std::string fullname = templateDirectory; std::string fullname = templateDirectory;
fullname += "/"; fullname += "/";

View File

@ -377,9 +377,9 @@ cmComputeLinkInformation
// Add the search path entries requested by the user to path ordering. // Add the search path entries requested by the user to path ordering.
this->OrderLinkerSearchPath this->OrderLinkerSearchPath
->AddUserDirectories(this->Target->Target->GetLinkDirectories()); ->AddUserDirectories(this->Target->GetLinkDirectories());
this->OrderRuntimeSearchPath this->OrderRuntimeSearchPath
->AddUserDirectories(this->Target->Target->GetLinkDirectories()); ->AddUserDirectories(this->Target->GetLinkDirectories());
// Set up the implicit link directories. // Set up the implicit link directories.
this->LoadImplicitLinkInfo(); this->LoadImplicitLinkInfo();
@ -413,7 +413,7 @@ cmComputeLinkInformation
// Construct a mask to not bother with this behavior for link // Construct a mask to not bother with this behavior for link
// directories already specified by the user. // directories already specified by the user.
std::vector<std::string> const& dirs = std::vector<std::string> const& dirs =
this->Target->Target->GetLinkDirectories(); this->Target->GetLinkDirectories();
this->OldLinkDirMask.insert(dirs.begin(), dirs.end()); this->OldLinkDirMask.insert(dirs.begin(), dirs.end());
} }

View File

@ -382,7 +382,7 @@ void cmComputeTargetDepends::AddTargetDepend(
<< "\" of target \"" << depender->GetName() << "\" does not exist."; << "\" of target \"" << depender->GetName() << "\" does not exist.";
cmListFileBacktrace const* backtrace = cmListFileBacktrace const* backtrace =
depender->Target->GetUtilityBacktrace(dependee_name); depender->GetUtilityBacktrace(dependee_name);
if(backtrace) if(backtrace)
{ {
cm->IssueMessage(messageType, e.str(), *backtrace); cm->IssueMessage(messageType, e.str(), *backtrace);

View File

@ -213,12 +213,8 @@ cmExportBuildFileGenerator
properties[prop] = value; properties[prop] = value;
} }
// Check whether this is a DLL platform.
bool dll_platform =
(mf->IsOn("WIN32") || mf->IsOn("CYGWIN") || mf->IsOn("MINGW"));
// Add the import library for windows DLLs. // Add the import library for windows DLLs.
if(dll_platform && if(target->IsDLLPlatform() &&
(target->GetType() == cmState::SHARED_LIBRARY || (target->GetType() == cmState::SHARED_LIBRARY ||
target->IsExecutableWithExports()) && target->IsExecutableWithExports()) &&
mf->GetDefinition("CMAKE_IMPORT_LIBRARY_SUFFIX")) mf->GetDefinition("CMAKE_IMPORT_LIBRARY_SUFFIX"))

View File

@ -879,10 +879,7 @@ cmExportFileGenerator
if(target->GetType() == cmState::SHARED_LIBRARY || if(target->GetType() == cmState::SHARED_LIBRARY ||
target->GetType() == cmState::MODULE_LIBRARY) target->GetType() == cmState::MODULE_LIBRARY)
{ {
// Check whether this is a DLL platform. if(!target->IsDLLPlatform())
bool dll_platform =
(mf->IsOn("WIN32") || mf->IsOn("CYGWIN") || mf->IsOn("MINGW"));
if(!dll_platform)
{ {
std::string prop; std::string prop;
std::string value; std::string value;

View File

@ -105,16 +105,18 @@ cmExportTryCompileFileGenerator::PopulateProperties(
ImportPropertyMap& properties, ImportPropertyMap& properties,
std::set<cmGeneratorTarget const*> &emitted) std::set<cmGeneratorTarget const*> &emitted)
{ {
cmPropertyMap props = target->Target->GetProperties(); std::vector<std::string> props = target->GetPropertyKeys();
for(cmPropertyMap::const_iterator i = props.begin(); i != props.end(); ++i) for(std::vector<std::string>::const_iterator i = props.begin();
i != props.end(); ++i)
{ {
properties[i->first] = i->second.GetValue();
if(i->first.find("IMPORTED_LINK_INTERFACE_LIBRARIES") == 0 properties[*i] = target->GetProperty(*i);
|| i->first.find("IMPORTED_LINK_DEPENDENT_LIBRARIES") == 0
|| i->first.find("INTERFACE_LINK_LIBRARIES") == 0) if(i->find("IMPORTED_LINK_INTERFACE_LIBRARIES") == 0
|| i->find("IMPORTED_LINK_DEPENDENT_LIBRARIES") == 0
|| i->find("INTERFACE_LINK_LIBRARIES") == 0)
{ {
std::string evalResult = this->FindTargets(i->first, std::string evalResult = this->FindTargets(*i,
target, emitted); target, emitted);
std::vector<std::string> depends; std::vector<std::string> depends;

View File

@ -383,6 +383,9 @@ void cmExtraCodeBlocksGenerator
all_files_map_t allFiles; all_files_map_t allFiles;
std::vector<std::string> cFiles; std::vector<std::string> cFiles;
std::vector<std::string> srcExts =
this->GlobalGenerator->GetCMakeInstance()->GetSourceExtensions();
for (std::vector<cmLocalGenerator*>::const_iterator lg=lgs.begin(); for (std::vector<cmLocalGenerator*>::const_iterator lg=lgs.begin();
lg!=lgs.end(); lg++) lg!=lgs.end(); lg++)
{ {
@ -420,9 +423,7 @@ void cmExtraCodeBlocksGenerator
{ {
std::string srcext = (*si)->GetExtension(); std::string srcext = (*si)->GetExtension();
for(std::vector<std::string>::const_iterator for(std::vector<std::string>::const_iterator
ext = mf->GetSourceExtensions().begin(); ext = srcExts.begin(); ext != srcExts.end(); ++ext)
ext != mf->GetSourceExtensions().end();
++ext)
{ {
if (srcext == *ext) if (srcext == *ext)
{ {
@ -449,6 +450,9 @@ void cmExtraCodeBlocksGenerator
} }
} }
std::vector<std::string> headerExts =
this->GlobalGenerator->GetCMakeInstance()->GetHeaderExtensions();
// The following loop tries to add header files matching to implementation // The following loop tries to add header files matching to implementation
// files to the project. It does that by iterating over all // files to the project. It does that by iterating over all
// C/C++ source files, // C/C++ source files,
@ -468,8 +472,8 @@ void cmExtraCodeBlocksGenerator
// check if there's a matching header around // check if there's a matching header around
for(std::vector<std::string>::const_iterator for(std::vector<std::string>::const_iterator
ext = mf->GetHeaderExtensions().begin(); ext = headerExts.begin();
ext != mf->GetHeaderExtensions().end(); ext != headerExts.end();
++ext) ++ext)
{ {
std::string hname=headerBasename; std::string hname=headerBasename;

View File

@ -149,6 +149,11 @@ void cmExtraCodeLiteGenerator
// which may have an acompanying header, one for all other files // which may have an acompanying header, one for all other files
std::string projectType; std::string projectType;
std::vector<std::string> srcExts =
this->GlobalGenerator->GetCMakeInstance()->GetSourceExtensions();
std::vector<std::string> headerExts =
this->GlobalGenerator->GetCMakeInstance()->GetHeaderExtensions();
std::map<std::string, cmSourceFile*> cFiles; std::map<std::string, cmSourceFile*> cFiles;
std::set<std::string> otherFiles; std::set<std::string> otherFiles;
for (std::vector<cmLocalGenerator*>::const_iterator lg=lgs.begin(); for (std::vector<cmLocalGenerator*>::const_iterator lg=lgs.begin();
@ -207,9 +212,7 @@ void cmExtraCodeLiteGenerator
{ {
std::string srcext = (*si)->GetExtension(); std::string srcext = (*si)->GetExtension();
for(std::vector<std::string>::const_iterator for(std::vector<std::string>::const_iterator
ext = mf->GetSourceExtensions().begin(); ext = srcExts.begin(); ext != srcExts.end(); ++ext)
ext != mf->GetSourceExtensions().end();
++ext)
{ {
if (srcext == *ext) if (srcext == *ext)
{ {
@ -253,8 +256,8 @@ void cmExtraCodeLiteGenerator
// check if there's a matching header around // check if there's a matching header around
for(std::vector<std::string>::const_iterator for(std::vector<std::string>::const_iterator
ext = mf->GetHeaderExtensions().begin(); ext = headerExts.begin();
ext != mf->GetHeaderExtensions().end(); ext != headerExts.end();
++ext) ++ext)
{ {
std::string hname=headerBasename; std::string hname=headerBasename;

View File

@ -393,7 +393,7 @@ struct CompilerIdNode : public cmGeneratorExpressionNode
if (cmsysString_strcasecmp(parameters.begin()->c_str(), compilerId) == 0) if (cmsysString_strcasecmp(parameters.begin()->c_str(), compilerId) == 0)
{ {
switch(context->LG->GetMakefile()->GetPolicyStatus(cmPolicies::CMP0044)) switch(context->LG->GetPolicyStatus(cmPolicies::CMP0044))
{ {
case cmPolicies::WARN: case cmPolicies::WARN:
{ {
@ -999,7 +999,7 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode
if (propertyName == "LINKER_LANGUAGE") if (propertyName == "LINKER_LANGUAGE")
{ {
if (target->Target->LinkLanguagePropagatesToDependents() && if (target->LinkLanguagePropagatesToDependents() &&
dagCheckerParent && (dagCheckerParent->EvaluatingLinkLibraries() dagCheckerParent && (dagCheckerParent->EvaluatingLinkLibraries()
|| dagCheckerParent->EvaluatingSources())) || dagCheckerParent->EvaluatingSources()))
{ {
@ -1100,7 +1100,7 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode
"COMPILE_DEFINITIONS_")) "COMPILE_DEFINITIONS_"))
{ {
cmPolicies::PolicyStatus polSt = cmPolicies::PolicyStatus polSt =
context->LG->GetMakefile()->GetPolicyStatus(cmPolicies::CMP0043); context->LG->GetPolicyStatus(cmPolicies::CMP0043);
if (polSt == cmPolicies::WARN || polSt == cmPolicies::OLD) if (polSt == cmPolicies::WARN || polSt == cmPolicies::OLD)
{ {
interfacePropertyName = "INTERFACE_COMPILE_DEFINITIONS"; interfacePropertyName = "INTERFACE_COMPILE_DEFINITIONS";
@ -1442,7 +1442,7 @@ cmPolicies::PolicyStatus statusForTarget(cmGeneratorTarget const* tgt,
#define RETURN_POLICY(POLICY) \ #define RETURN_POLICY(POLICY) \
if (strcmp(policy, #POLICY) == 0) \ if (strcmp(policy, #POLICY) == 0) \
{ \ { \
return tgt->Target->GetPolicyStatus ## POLICY (); \ return tgt->GetPolicyStatus ## POLICY (); \
} \ } \
CM_FOR_EACH_TARGET_POLICY(RETURN_POLICY) CM_FOR_EACH_TARGET_POLICY(RETURN_POLICY)

View File

@ -796,7 +796,7 @@ std::set<cmLinkItem> const& cmGeneratorTarget::GetUtilityItems() const
if(!this->UtilityItemsDone) if(!this->UtilityItemsDone)
{ {
this->UtilityItemsDone = true; this->UtilityItemsDone = true;
std::set<std::string> const& utilities = this->Target->GetUtilities(); std::set<std::string> const& utilities = this->GetUtilities();
for(std::set<std::string>::const_iterator i = utilities.begin(); for(std::set<std::string>::const_iterator i = utilities.begin();
i != utilities.end(); ++i) i != utilities.end(); ++i)
{ {
@ -833,11 +833,34 @@ const char* cmGeneratorTarget::GetLocation(const std::string& config) const
return location.c_str(); return location.c_str();
} }
std::vector<cmCustomCommand> const&
cmGeneratorTarget::GetPreBuildCommands() const
{
return this->Target->GetPreBuildCommands();
}
std::vector<cmCustomCommand> const&
cmGeneratorTarget::GetPreLinkCommands() const
{
return this->Target->GetPreLinkCommands();
}
std::vector<cmCustomCommand> const&
cmGeneratorTarget::GetPostBuildCommands() const
{
return this->Target->GetPostBuildCommands();
}
bool cmGeneratorTarget::IsImported() const bool cmGeneratorTarget::IsImported() const
{ {
return this->Target->IsImported(); return this->Target->IsImported();
} }
bool cmGeneratorTarget::IsImportedGloballyVisible() const
{
return this->Target->IsImportedGloballyVisible();
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
const char* cmGeneratorTarget::GetLocationForBuild() const const char* cmGeneratorTarget::GetLocationForBuild() const
{ {
@ -1623,7 +1646,7 @@ cmGeneratorTarget::GetFrameworkDirectory(const std::string& config,
if(!rootDir && !this->Makefile->PlatformIsAppleIos()) if(!rootDir && !this->Makefile->PlatformIsAppleIos())
{ {
fpath += "/Versions/"; fpath += "/Versions/";
fpath += this->Target->GetFrameworkVersion(); fpath += this->GetFrameworkVersion();
} }
return fpath; return fpath;
} }
@ -1714,6 +1737,22 @@ cmListFileBacktrace cmGeneratorTarget::GetBacktrace() const
return this->Target->GetBacktrace(); return this->Target->GetBacktrace();
} }
const std::vector<std::string>&cmGeneratorTarget::GetLinkDirectories() const
{
return this->Target->GetLinkDirectories();
}
const std::set<std::string>& cmGeneratorTarget::GetUtilities() const
{
return this->Target->GetUtilities();
}
const cmListFileBacktrace*
cmGeneratorTarget::GetUtilityBacktrace(const std::string& u) const
{
return this->Target->GetUtilityBacktrace(u);
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
bool cmGeneratorTarget::HaveWellDefinedOutputFiles() const bool cmGeneratorTarget::HaveWellDefinedOutputFiles() const
{ {
@ -1759,7 +1798,7 @@ public:
UNORDERED_SET<std::string>& languages, UNORDERED_SET<std::string>& languages,
cmGeneratorTarget const* head): cmGeneratorTarget const* head):
Config(config), Languages(languages), HeadTarget(head), Config(config), Languages(languages), HeadTarget(head),
Makefile(target->Target->GetMakefile()), Target(target) Target(target)
{ this->Visited.insert(target); } { this->Visited.insert(target); }
void Visit(cmLinkItem const& item) void Visit(cmLinkItem const& item)
@ -1771,7 +1810,8 @@ public:
bool noMessage = false; bool noMessage = false;
cmake::MessageType messageType = cmake::FATAL_ERROR; cmake::MessageType messageType = cmake::FATAL_ERROR;
std::stringstream e; std::stringstream e;
switch(this->Makefile->GetPolicyStatus(cmPolicies::CMP0028)) switch(this->Target->GetLocalGenerator()
->GetPolicyStatus(cmPolicies::CMP0028))
{ {
case cmPolicies::WARN: case cmPolicies::WARN:
{ {
@ -1825,7 +1865,6 @@ private:
std::string Config; std::string Config;
UNORDERED_SET<std::string>& Languages; UNORDERED_SET<std::string>& Languages;
cmGeneratorTarget const* HeadTarget; cmGeneratorTarget const* HeadTarget;
cmMakefile* Makefile;
const cmGeneratorTarget* Target; const cmGeneratorTarget* Target;
std::set<cmGeneratorTarget const*> Visited; std::set<cmGeneratorTarget const*> Visited;
}; };
@ -2267,11 +2306,11 @@ cmTargetTraceDependencies
// Queue pre-build, pre-link, and post-build rule dependencies. // Queue pre-build, pre-link, and post-build rule dependencies.
this->CheckCustomCommands( this->CheckCustomCommands(
this->GeneratorTarget->Target->GetPreBuildCommands()); this->GeneratorTarget->GetPreBuildCommands());
this->CheckCustomCommands( this->CheckCustomCommands(
this->GeneratorTarget->Target->GetPreLinkCommands()); this->GeneratorTarget->GetPreLinkCommands());
this->CheckCustomCommands( this->CheckCustomCommands(
this->GeneratorTarget->Target->GetPostBuildCommands()); this->GeneratorTarget->GetPostBuildCommands());
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
@ -3313,7 +3352,7 @@ void cmGeneratorTarget::GetLibraryNames(std::string& name,
if(!this->Makefile->PlatformIsAppleIos()) if(!this->Makefile->PlatformIsAppleIos())
{ {
realName += "Versions/"; realName += "Versions/";
realName += this->Target->GetFrameworkVersion(); realName += this->GetFrameworkVersion();
realName += "/"; realName += "/";
} }
realName += base; realName += base;
@ -4217,9 +4256,11 @@ PropertyType checkInterfacePropertyCompatibility(cmGeneratorTarget const* tgt,
PropertyType *) PropertyType *)
{ {
PropertyType propContent = getTypedProperty<PropertyType>(tgt, p); PropertyType propContent = getTypedProperty<PropertyType>(tgt, p);
const bool explicitlySet = tgt->Target->GetProperties() std::vector<std::string> headPropKeys = tgt->GetPropertyKeys();
.find(p) const bool explicitlySet =
!= tgt->Target->GetProperties().end(); std::find(headPropKeys.begin(), headPropKeys.end(),
p) != headPropKeys.end();
const bool impliedByUse = const bool impliedByUse =
tgt->IsNullImpliedByLinkLibraries(p); tgt->IsNullImpliedByLinkLibraries(p);
assert((impliedByUse ^ explicitlySet) assert((impliedByUse ^ explicitlySet)
@ -4264,9 +4305,11 @@ PropertyType checkInterfacePropertyCompatibility(cmGeneratorTarget const* tgt,
cmGeneratorTarget const* theTarget = *li; cmGeneratorTarget const* theTarget = *li;
const bool ifaceIsSet = theTarget->Target->GetProperties() std::vector<std::string> propKeys = theTarget->GetPropertyKeys();
.find(interfaceProperty)
!= theTarget->Target->GetProperties().end(); const bool ifaceIsSet =
std::find(propKeys.begin(), propKeys.end(),
interfaceProperty) != propKeys.end();
PropertyType ifacePropContent = PropertyType ifacePropContent =
getTypedProperty<PropertyType>(theTarget, getTypedProperty<PropertyType>(theTarget,
interfaceProperty); interfaceProperty);
@ -4507,6 +4550,25 @@ void cmGeneratorTarget::GetTargetVersion(bool soversion,
} }
} }
//----------------------------------------------------------------------------
std::string cmGeneratorTarget::GetFrameworkVersion() const
{
assert(this->GetType() != cmState::INTERFACE_LIBRARY);
if(const char* fversion = this->GetProperty("FRAMEWORK_VERSION"))
{
return fversion;
}
else if(const char* tversion = this->GetProperty("VERSION"))
{
return tversion;
}
else
{
return "A";
}
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void cmGeneratorTarget::ComputeVersionedName(std::string& vName, void cmGeneratorTarget::ComputeVersionedName(std::string& vName,
std::string const& prefix, std::string const& prefix,
@ -4524,6 +4586,19 @@ void cmGeneratorTarget::ComputeVersionedName(std::string& vName,
vName += this->Makefile->IsOn("APPLE") ? suffix : std::string(); vName += this->Makefile->IsOn("APPLE") ? suffix : std::string();
} }
std::vector<std::string> cmGeneratorTarget::GetPropertyKeys() const
{
cmPropertyMap propsObject = this->Target->GetProperties();
std::vector<std::string> props;
props.reserve(propsObject.size());
for (cmPropertyMap::const_iterator it = propsObject.begin();
it != propsObject.end(); ++it)
{
props.push_back(it->first);
}
return props;
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void void
cmGeneratorTarget::ReportPropertyOrigin(const std::string &p, cmGeneratorTarget::ReportPropertyOrigin(const std::string &p,
@ -4717,7 +4792,7 @@ void cmGeneratorTarget::ComputeLinkInterface(const std::string& config,
iface.WrongConfigLibraries = impl->WrongConfigLibraries; iface.WrongConfigLibraries = impl->WrongConfigLibraries;
} }
if(this->Target->LinkLanguagePropagatesToDependents()) if(this->LinkLanguagePropagatesToDependents())
{ {
// Targets using this archive need its language runtime libraries. // Targets using this archive need its language runtime libraries.
if(cmLinkImplementation const* impl = if(cmLinkImplementation const* impl =
@ -5432,7 +5507,7 @@ void cmGeneratorTarget::ComputeImportInfo(std::string const& desired_config,
} }
// Get the link languages. // Get the link languages.
if(this->Target->LinkLanguagePropagatesToDependents()) if(this->LinkLanguagePropagatesToDependents())
{ {
std::string linkProp = "IMPORTED_LINK_INTERFACE_LANGUAGES"; std::string linkProp = "IMPORTED_LINK_INTERFACE_LANGUAGES";
linkProp += suffix; linkProp += suffix;
@ -5490,7 +5565,7 @@ cmGeneratorTarget::GetLinkImplementation(const std::string& config) const
} }
std::string CONFIG = cmSystemTools::UpperCase(config); std::string CONFIG = cmSystemTools::UpperCase(config);
cmOptionalLinkImplementation& impl = this->LinkImplMap[CONFIG][this->Target]; cmOptionalLinkImplementation& impl = this->LinkImplMap[CONFIG][this];
if(!impl.LibrariesDone) if(!impl.LibrariesDone)
{ {
impl.LibrariesDone = true; impl.LibrariesDone = true;
@ -5770,7 +5845,7 @@ cmGeneratorTarget::GetLinkImplementationLibrariesInternal(
return &hm.begin()->second; return &hm.begin()->second;
} }
cmOptionalLinkImplementation& impl = hm[head->Target]; cmOptionalLinkImplementation& impl = hm[head];
if(!impl.LibrariesDone) if(!impl.LibrariesDone)
{ {
impl.LibrariesDone = true; impl.LibrariesDone = true;

View File

@ -31,8 +31,13 @@ public:
cmLocalGenerator* GetLocalGenerator() const; cmLocalGenerator* GetLocalGenerator() const;
bool IsImported() const; bool IsImported() const;
bool IsImportedGloballyVisible() const;
const char *GetLocation(const std::string& config) const; const char *GetLocation(const std::string& config) const;
std::vector<cmCustomCommand> const &GetPreBuildCommands() const;
std::vector<cmCustomCommand> const &GetPreLinkCommands() const;
std::vector<cmCustomCommand> const &GetPostBuildCommands() const;
#define DECLARE_TARGET_POLICY(POLICY) \ #define DECLARE_TARGET_POLICY(POLICY) \
cmPolicies::PolicyStatus GetPolicyStatus ## POLICY () const \ cmPolicies::PolicyStatus GetPolicyStatus ## POLICY () const \
{ return this->PolicyMap.Get(cmPolicies::POLICY); } { return this->PolicyMap.Get(cmPolicies::POLICY); }
@ -53,6 +58,7 @@ public:
std::string GetName() const; std::string GetName() const;
std::string GetExportName() const; std::string GetExportName() const;
std::vector<std::string> GetPropertyKeys() 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,
@ -161,6 +167,10 @@ public:
std::string GetFrameworkDirectory(const std::string& config, std::string GetFrameworkDirectory(const std::string& config,
bool rootDir) const; bool rootDir) const;
/** Return the framework version string. Undefined if
IsFrameworkOnApple returns false. */
std::string GetFrameworkVersion() const;
/** @return the Mac CFBundle directory without the base */ /** @return the Mac CFBundle directory without the base */
std::string GetCFBundleDirectory(const std::string& config, std::string GetCFBundleDirectory(const std::string& config,
bool contentOnly) const; bool contentOnly) const;
@ -176,6 +186,14 @@ public:
cmListFileBacktrace GetBacktrace() const; cmListFileBacktrace GetBacktrace() const;
const std::vector<std::string>& GetLinkDirectories() const;
std::set<std::string>const& GetUtilities() const;
cmListFileBacktrace const* GetUtilityBacktrace(const std::string& u) const;
bool LinkLanguagePropagatesToDependents() const
{ return this->GetType() == cmState::STATIC_LIBRARY; }
/** Get the macro to define when building sources in this target. /** Get the macro to define when building sources in this target.
If no macro should be defined null is returned. */ If no macro should be defined null is returned. */
const char* GetExportMacro() const; const char* GetExportMacro() const;
@ -630,7 +648,7 @@ private:
const std::string& config) const; const std::string& config) const;
struct HeadToLinkImplementationMap: struct HeadToLinkImplementationMap:
public std::map<cmTarget const*, cmOptionalLinkImplementation> {}; public std::map<cmGeneratorTarget const*, cmOptionalLinkImplementation> {};
typedef std::map<std::string, typedef std::map<std::string,
HeadToLinkImplementationMap> LinkImplMapType; HeadToLinkImplementationMap> LinkImplMapType;
mutable LinkImplMapType LinkImplMap; mutable LinkImplMapType LinkImplMap;

View File

@ -392,10 +392,10 @@ void cmGhsMultiTargetGenerator::WriteTargetLinkLibraries()
void cmGhsMultiTargetGenerator::WriteCustomCommands() void cmGhsMultiTargetGenerator::WriteCustomCommands()
{ {
WriteCustomCommandsHelper( WriteCustomCommandsHelper(
this->GeneratorTarget->Target->GetPreBuildCommands(), this->GeneratorTarget->GetPreBuildCommands(),
cmTarget::PRE_BUILD); cmTarget::PRE_BUILD);
WriteCustomCommandsHelper( WriteCustomCommandsHelper(
this->GeneratorTarget->Target->GetPostBuildCommands(), this->GeneratorTarget->GetPostBuildCommands(),
cmTarget::POST_BUILD); cmTarget::POST_BUILD);
} }

View File

@ -1208,8 +1208,6 @@ void cmGlobalGenerator::Configure()
void cmGlobalGenerator::CreateGenerationObjects(TargetTypes targetTypes) void cmGlobalGenerator::CreateGenerationObjects(TargetTypes targetTypes)
{ {
this->CreateLocalGenerators(); this->CreateLocalGenerators();
cmDeleteAll(this->GeneratorTargets);
this->GeneratorTargets.clear();
this->CreateGeneratorTargets(targetTypes); this->CreateGeneratorTargets(targetTypes);
this->ComputeBuildFileGenerators(); this->ComputeBuildFileGenerators();
} }
@ -1583,10 +1581,12 @@ void cmGlobalGenerator::FinalizeTargetCompileInfo()
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void cmGlobalGenerator::CreateGeneratorTargets(TargetTypes targetTypes, void cmGlobalGenerator::CreateGeneratorTargets(
cmLocalGenerator *lg) TargetTypes targetTypes,
cmMakefile *mf,
cmLocalGenerator *lg,
std::map<cmTarget*, cmGeneratorTarget*> const& importedMap)
{ {
cmMakefile* mf = lg->GetMakefile();
if (targetTypes == AllTargets) if (targetTypes == AllTargets)
{ {
cmTargets& targets = mf->GetTargets(); cmTargets& targets = mf->GetTargets();
@ -1595,27 +1595,42 @@ void cmGlobalGenerator::CreateGeneratorTargets(TargetTypes targetTypes,
{ {
cmTarget* t = &ti->second; cmTarget* t = &ti->second;
cmGeneratorTarget* gt = new cmGeneratorTarget(t, lg); cmGeneratorTarget* gt = new cmGeneratorTarget(t, lg);
this->GeneratorTargets[t] = gt;
lg->AddGeneratorTarget(gt); lg->AddGeneratorTarget(gt);
} }
} }
std::vector<cmTarget*> itgts = mf->GetImportedTargets();
for(std::vector<cmTarget*>::const_iterator for(std::vector<cmTarget*>::const_iterator
j = mf->GetOwnedImportedTargets().begin(); j = itgts.begin(); j != itgts.end(); ++j)
j != mf->GetOwnedImportedTargets().end(); ++j)
{ {
cmGeneratorTarget* gt = new cmGeneratorTarget(*j, lg); lg->AddImportedGeneratorTarget(importedMap.find(*j)->second);
this->GeneratorTargets[*j] = gt;
} }
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void cmGlobalGenerator::CreateGeneratorTargets(TargetTypes targetTypes) void cmGlobalGenerator::CreateGeneratorTargets(TargetTypes targetTypes)
{ {
std::map<cmTarget*, cmGeneratorTarget*> importedMap;
for(unsigned int i=0; i < this->Makefiles.size(); ++i)
{
cmMakefile* mf = this->Makefiles[i];
for(std::vector<cmTarget*>::const_iterator
j = mf->GetOwnedImportedTargets().begin();
j != mf->GetOwnedImportedTargets().end(); ++j)
{
cmLocalGenerator* lg = this->LocalGenerators[i];
cmGeneratorTarget* gt = new cmGeneratorTarget(*j, lg);
lg->AddOwnedImportedGeneratorTarget(gt);
importedMap[*j] = gt;
}
}
// Construct per-target generator information. // Construct per-target generator information.
for(unsigned int i=0; i < this->LocalGenerators.size(); ++i) for(unsigned int i=0; i < this->LocalGenerators.size(); ++i)
{ {
this->CreateGeneratorTargets(targetTypes, this->LocalGenerators[i]); this->CreateGeneratorTargets(targetTypes, this->Makefiles[i],
this->LocalGenerators[i], importedMap);
} }
} }
@ -1623,9 +1638,6 @@ void cmGlobalGenerator::CreateGeneratorTargets(TargetTypes targetTypes)
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void cmGlobalGenerator::ClearGeneratorMembers() void cmGlobalGenerator::ClearGeneratorMembers()
{ {
cmDeleteAll(this->GeneratorTargets);
this->GeneratorTargets.clear();
cmDeleteAll(this->BuildExportSets); cmDeleteAll(this->BuildExportSets);
this->BuildExportSets.clear(); this->BuildExportSets.clear();
@ -1637,28 +1649,12 @@ void cmGlobalGenerator::ClearGeneratorMembers()
this->ExportSets.clear(); this->ExportSets.clear();
this->TargetDependencies.clear(); this->TargetDependencies.clear();
this->TotalTargets.clear();
this->ImportedTargets.clear();
this->ProjectMap.clear(); this->ProjectMap.clear();
this->RuleHashes.clear(); this->RuleHashes.clear();
this->DirectoryContentMap.clear(); this->DirectoryContentMap.clear();
this->BinaryDirectories.clear(); this->BinaryDirectories.clear();
} }
//----------------------------------------------------------------------------
cmGeneratorTarget*
cmGlobalGenerator::GetGeneratorTarget(cmTarget const* t) const
{
cmGeneratorTargetsType::const_iterator ti = this->GeneratorTargets.find(t);
if(ti == this->GeneratorTargets.end())
{
this->CMakeInstance->IssueMessage(
cmake::INTERNAL_ERROR, "Missing cmGeneratorTarget instance!");
return 0;
}
return ti->second;
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void cmGlobalGenerator::ComputeTargetObjectDirectory(cmGeneratorTarget*) const void cmGlobalGenerator::ComputeTargetObjectDirectory(cmGeneratorTarget*) const
{ {
@ -2169,9 +2165,10 @@ cmGlobalGenerator::FindLocalGenerator(const std::string& start_dir) const
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void cmGlobalGenerator::AddAlias(const std::string& name, cmTarget *tgt) void cmGlobalGenerator::AddAlias(const std::string& name,
std::string const& tgtName)
{ {
this->AliasTargets[name] = tgt; this->AliasTargets[name] = tgtName;
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
@ -2180,6 +2177,79 @@ bool cmGlobalGenerator::IsAlias(const std::string& name) const
return this->AliasTargets.find(name) != this->AliasTargets.end(); return this->AliasTargets.find(name) != this->AliasTargets.end();
} }
cmTarget* cmGlobalGenerator::FindTargetImpl(std::string const& name) const
{
for (unsigned int i = 0; i < this->Makefiles.size(); ++i)
{
cmTargets& tgts = this->Makefiles[i]->GetTargets();
for (cmTargets::iterator it = tgts.begin(); it != tgts.end(); ++it)
{
if (it->second.GetName() == name)
{
return &it->second;
}
}
}
return 0;
}
cmGeneratorTarget*
cmGlobalGenerator::FindGeneratorTargetImpl(std::string const& name) const
{
for (unsigned int i = 0; i < this->LocalGenerators.size(); ++i)
{
std::vector<cmGeneratorTarget*> tgts =
this->LocalGenerators[i]->GetGeneratorTargets();
for (std::vector<cmGeneratorTarget*>::iterator it = tgts.begin();
it != tgts.end(); ++it)
{
if ((*it)->GetName() == name)
{
return *it;
}
}
}
return 0;
}
cmTarget*
cmGlobalGenerator::FindImportedTargetImpl(std::string const& name) const
{
for (unsigned int i = 0; i < this->Makefiles.size(); ++i)
{
std::vector<cmTarget*> tgts =
this->Makefiles[i]->GetOwnedImportedTargets();
for (std::vector<cmTarget*>::iterator it = tgts.begin();
it != tgts.end(); ++it)
{
if ((*it)->GetName() == name && (*it)->IsImportedGloballyVisible())
{
return *it;
}
}
}
return 0;
}
cmGeneratorTarget* cmGlobalGenerator::FindImportedGeneratorTargetImpl(
std::string const& name) const
{
for (unsigned int i = 0; i < this->LocalGenerators.size(); ++i)
{
std::vector<cmGeneratorTarget*> tgts =
this->LocalGenerators[i]->GetImportedGeneratorTargets();
for (std::vector<cmGeneratorTarget*>::iterator it = tgts.begin();
it != tgts.end(); ++it)
{
if ((*it)->IsImportedGloballyVisible() && (*it)->GetName() == name)
{
return *it;
}
}
}
return 0;
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
cmTarget* cmTarget*
cmGlobalGenerator::FindTarget(const std::string& name, cmGlobalGenerator::FindTarget(const std::string& name,
@ -2187,23 +2257,28 @@ cmGlobalGenerator::FindTarget(const std::string& name,
{ {
if (!excludeAliases) if (!excludeAliases)
{ {
TargetMap::const_iterator ai = this->AliasTargets.find(name); std::map<std::string, std::string>::const_iterator ai =
this->AliasTargets.find(name);
if (ai != this->AliasTargets.end()) if (ai != this->AliasTargets.end())
{ {
return ai->second; return this->FindTargetImpl(ai->second);
} }
} }
TargetMap::const_iterator i = this->TotalTargets.find ( name ); if (cmTarget* tgt = this->FindTargetImpl(name))
if ( i != this->TotalTargets.end() )
{ {
return i->second; return tgt;
} }
i = this->ImportedTargets.find(name); return this->FindImportedTargetImpl(name);
if ( i != this->ImportedTargets.end() ) }
cmGeneratorTarget*
cmGlobalGenerator::FindGeneratorTarget(const std::string& name) const
{
if (cmGeneratorTarget* tgt = this->FindGeneratorTargetImpl(name))
{ {
return i->second; return tgt;
} }
return 0; return this->FindImportedGeneratorTargetImpl(name);
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
@ -2217,8 +2292,7 @@ cmGlobalGenerator::NameResolvesToFramework(const std::string& libname) const
if(cmTarget* tgt = this->FindTarget(libname)) if(cmTarget* tgt = this->FindTarget(libname))
{ {
cmGeneratorTarget* gt = this->GetGeneratorTarget(tgt); if(tgt->IsFrameworkOnApple())
if(gt->IsFrameworkOnApple())
{ {
return true; return true;
} }
@ -2622,18 +2696,6 @@ cmGlobalGenerator::GetTargetDirectDepends(cmGeneratorTarget const* target)
return this->TargetDependencies[target]; return this->TargetDependencies[target];
} }
void cmGlobalGenerator::AddTarget(cmTarget* t)
{
if(t->IsImported())
{
this->ImportedTargets[t->GetName()] = t;
}
else
{
this->TotalTargets[t->GetName()] = t;
}
}
bool cmGlobalGenerator::IsReservedTarget(std::string const& name) bool cmGlobalGenerator::IsReservedTarget(std::string const& name)
{ {
// The following is a list of targets reserved // The following is a list of targets reserved
@ -2939,17 +3001,20 @@ void cmGlobalGenerator::WriteSummary()
fname += "/TargetDirectories.txt"; fname += "/TargetDirectories.txt";
cmGeneratedFileStream fout(fname.c_str()); cmGeneratedFileStream fout(fname.c_str());
// Generate summary information files for each target. for (unsigned int i = 0; i < this->LocalGenerators.size(); ++i)
for(TargetMap::const_iterator ti =
this->TotalTargets.begin(); ti != this->TotalTargets.end(); ++ti)
{ {
if ((ti->second)->GetType() == cmState::INTERFACE_LIBRARY) std::vector<cmGeneratorTarget*> tgts =
this->LocalGenerators[i]->GetGeneratorTargets();
for (std::vector<cmGeneratorTarget*>::iterator it = tgts.begin();
it != tgts.end(); ++it)
{ {
continue; if ((*it)->GetType() == cmState::INTERFACE_LIBRARY)
{
continue;
}
this->WriteSummary(*it);
fout << (*it)->GetSupportDirectory() << "\n";
} }
cmGeneratorTarget* gt = this->GetGeneratorTarget(ti->second);
this->WriteSummary(gt);
fout << gt->GetSupportDirectory() << "\n";
} }
} }

View File

@ -42,10 +42,6 @@ class cmInstallTargetGenerator;
class cmInstallFilesGenerator; class cmInstallFilesGenerator;
class cmExportBuildFileGenerator; class cmExportBuildFileGenerator;
typedef std::map<cmTarget const*,
cmGeneratorTarget*,
cmTarget::StrictTargetComparison> cmGeneratorTargetsType;
/** \class cmGlobalGenerator /** \class cmGlobalGenerator
* \brief Responsible for overseeing the generation process for the entire tree * \brief Responsible for overseeing the generation process for the entire tree
* *
@ -254,7 +250,9 @@ public:
cmTarget* FindTarget(const std::string& name, cmTarget* FindTarget(const std::string& name,
bool excludeAliases = false) const; bool excludeAliases = false) const;
void AddAlias(const std::string& name, cmTarget *tgt); cmGeneratorTarget* FindGeneratorTarget(const std::string& name) const;
void AddAlias(const std::string& name, const std::string& tgtName);
bool IsAlias(const std::string& name) const; bool IsAlias(const std::string& name) const;
/** Determine if a name resolves to a framework on disk or a built target /** Determine if a name resolves to a framework on disk or a built target
@ -280,8 +278,6 @@ public:
std::set<std::string> const& GetDirectoryContent(std::string const& dir, std::set<std::string> const& GetDirectoryContent(std::string const& dir,
bool needDisk = true); bool needDisk = true);
void AddTarget(cmTarget* t);
static bool IsReservedTarget(std::string const& name); static bool IsReservedTarget(std::string const& name);
virtual const char* GetAllTargetName() const { return "ALL_BUILD"; } virtual const char* GetAllTargetName() const { return "ALL_BUILD"; }
@ -307,14 +303,6 @@ public:
TargetDependSet const& GetTargetDirectDepends( TargetDependSet const& GetTargetDirectDepends(
const cmGeneratorTarget* target); const cmGeneratorTarget* target);
/** Get per-target generator information. */
cmGeneratorTarget* GetGeneratorTarget(cmTarget const*) const;
void AddGeneratorTarget(cmTarget* t, cmGeneratorTarget* gt)
{
this->GeneratorTargets[t] = gt;
}
const std::map<std::string, std::vector<cmLocalGenerator*> >& GetProjectMap() const std::map<std::string, std::vector<cmLocalGenerator*> >& GetProjectMap()
const {return this->ProjectMap;} const {return this->ProjectMap;}
@ -429,19 +417,14 @@ protected:
std::map<std::string, cmExportBuildFileGenerator*> BuildExportSets; std::map<std::string, cmExportBuildFileGenerator*> BuildExportSets;
std::map<std::string, cmExportBuildFileGenerator*> BuildExportExportSets; std::map<std::string, cmExportBuildFileGenerator*> BuildExportExportSets;
// All targets in the entire project. std::map<std::string, std::string> AliasTargets;
#if defined(CMAKE_BUILD_WITH_CMAKE)
#ifdef CMake_HAVE_CXX11_UNORDERED_MAP cmTarget* FindTargetImpl(std::string const& name) const;
typedef std::unordered_map<std::string, cmTarget*> TargetMap; cmTarget* FindImportedTargetImpl(std::string const& name) const;
#else
typedef cmsys::hash_map<std::string, cmTarget*> TargetMap; cmGeneratorTarget* FindGeneratorTargetImpl(std::string const& name) const;
#endif cmGeneratorTarget*
#else FindImportedGeneratorTargetImpl(std::string const& name) const;
typedef std::map<std::string,cmTarget *> TargetMap;
#endif
TargetMap TotalTargets;
TargetMap AliasTargets;
TargetMap ImportedTargets;
const char* GetPredefinedTargetsFolder(); const char* GetPredefinedTargetsFolder();
virtual bool UseFolderProperty(); virtual bool UseFolderProperty();
@ -487,10 +470,10 @@ private:
typedef std::map<cmGeneratorTarget const*, TargetDependSet> TargetDependMap; typedef std::map<cmGeneratorTarget const*, TargetDependSet> TargetDependMap;
TargetDependMap TargetDependencies; TargetDependMap TargetDependencies;
// Per-target generator information.
cmGeneratorTargetsType GeneratorTargets;
friend class cmake; friend class cmake;
void CreateGeneratorTargets(TargetTypes targetTypes, cmLocalGenerator* lg); void CreateGeneratorTargets(TargetTypes targetTypes, cmMakefile* mf,
cmLocalGenerator* lg,
std::map<cmTarget*, cmGeneratorTarget*> const& importedMap);
void CreateGeneratorTargets(TargetTypes targetTypes); void CreateGeneratorTargets(TargetTypes targetTypes);
void ClearGeneratorMembers(); void ClearGeneratorMembers();

View File

@ -105,6 +105,9 @@ bool cmGlobalKdevelopGenerator
std::set<std::string> files; std::set<std::string> files;
std::string tmp; std::string tmp;
std::vector<std::string> hdrExts =
this->GlobalGenerator->GetCMakeInstance()->GetHeaderExtensions();
for (std::vector<cmLocalGenerator*>::const_iterator it=lgs.begin(); for (std::vector<cmLocalGenerator*>::const_iterator it=lgs.begin();
it!=lgs.end(); it++) it!=lgs.end(); it++)
{ {
@ -160,8 +163,7 @@ bool cmGlobalKdevelopGenerator
// check if there's a matching header around // check if there's a matching header around
for(std::vector<std::string>::const_iterator for(std::vector<std::string>::const_iterator
ext = makefile->GetHeaderExtensions().begin(); ext = hdrExts.begin(); ext != hdrExts.end(); ++ext)
ext != makefile->GetHeaderExtensions().end(); ++ext)
{ {
std::string hname=headerBasename; std::string hname=headerBasename;
hname += "."; hname += ".";

View File

@ -965,7 +965,7 @@ cmGlobalNinjaGenerator
if (target->GetType() == cmState::GLOBAL_TARGET) { if (target->GetType() == cmState::GLOBAL_TARGET) {
// Global targets only depend on other utilities, which may not appear in // Global targets only depend on other utilities, which may not appear in
// the TargetDepends set (e.g. "all"). // the TargetDepends set (e.g. "all").
std::set<std::string> const& utils = target->Target->GetUtilities(); std::set<std::string> const& utils = target->GetUtilities();
std::copy(utils.begin(), utils.end(), std::back_inserter(outputs)); std::copy(utils.begin(), utils.end(), std::back_inserter(outputs));
} else { } else {
cmTargetDependSet const& targetDeps = this->GetTargetDirectDepends(target); cmTargetDependSet const& targetDeps = this->GetTargetDirectDepends(target);

View File

@ -523,7 +523,7 @@ cmGlobalUnixMakefileGenerator3
cmLocalUnixMakefileGenerator3* lg) cmLocalUnixMakefileGenerator3* lg)
{ {
// Only subdirectories need these rules. // Only subdirectories need these rules.
if(lg->GetMakefile()->IsRootMakefile()) if(lg->IsRootMakefile())
{ {
return; return;
} }
@ -1084,7 +1084,7 @@ void cmGlobalUnixMakefileGenerator3::WriteHelpRule
static_cast<cmLocalUnixMakefileGenerator3 *>(this->LocalGenerators[i]); static_cast<cmLocalUnixMakefileGenerator3 *>(this->LocalGenerators[i]);
// for the passed in makefile or if this is the top Makefile wripte out // for the passed in makefile or if this is the top Makefile wripte out
// the targets // the targets
if (lg2 == lg || lg->GetMakefile()->IsRootMakefile()) if (lg2 == lg || lg->IsRootMakefile())
{ {
// for each target Generate the rule files for each target. // for each target Generate the rule files for each target.
std::vector<cmGeneratorTarget*> targets = lg2->GetGeneratorTargets(); std::vector<cmGeneratorTarget*> targets = lg2->GetGeneratorTargets();

View File

@ -235,7 +235,7 @@ void cmGlobalVisualStudio6Generator
std::string project = target->GetName(); std::string project = target->GetName();
std::string location = expath; std::string location = expath;
this->WriteExternalProject(fout, project.c_str(), this->WriteExternalProject(fout, project.c_str(),
location.c_str(), target->Target->GetUtilities()); location.c_str(), target->GetUtilities());
} }
else else
{ {

View File

@ -401,7 +401,7 @@ void cmGlobalVisualStudio7Generator::WriteTargetConfigurations(
for(OrderedTargetDependSet::const_iterator tt = for(OrderedTargetDependSet::const_iterator tt =
projectTargets.begin(); tt != projectTargets.end(); ++tt) projectTargets.begin(); tt != projectTargets.end(); ++tt)
{ {
cmTarget const* target = (*tt)->Target; cmGeneratorTarget const* target = *tt;
if(target->GetType() == cmState::INTERFACE_LIBRARY) if(target->GetType() == cmState::INTERFACE_LIBRARY)
{ {
continue; continue;
@ -459,7 +459,7 @@ void cmGlobalVisualStudio7Generator::WriteTargetsToSolution(
project.c_str(), project.c_str(),
location.c_str(), location.c_str(),
target->GetProperty("VS_PROJECT_TYPE"), target->GetProperty("VS_PROJECT_TYPE"),
target->Target->GetUtilities()); target->GetUtilities());
written = true; written = true;
} }
else else
@ -996,7 +996,8 @@ cmGlobalVisualStudio7Generator
std::set<std::string> std::set<std::string>
cmGlobalVisualStudio7Generator::IsPartOfDefaultBuild( cmGlobalVisualStudio7Generator::IsPartOfDefaultBuild(
std::vector<std::string> const& configs, std::vector<std::string> const& configs,
OrderedTargetDependSet const& projectTargets, cmTarget const* target) OrderedTargetDependSet const& projectTargets,
cmGeneratorTarget const* target)
{ {
std::set<std::string> activeConfigs; std::set<std::string> activeConfigs;
// if it is a utilitiy target then only make it part of the // if it is a utilitiy target then only make it part of the
@ -1011,13 +1012,13 @@ cmGlobalVisualStudio7Generator::IsPartOfDefaultBuild(
for(std::vector<std::string>::const_iterator i = configs.begin(); for(std::vector<std::string>::const_iterator i = configs.begin();
i != configs.end(); ++i) i != configs.end(); ++i)
{ {
const char* propertyValue = target->GetMakefile() const char* propertyValue = target->Target->GetMakefile()
->GetDefinition("CMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD"); ->GetDefinition("CMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD");
cmGeneratorExpression ge; cmGeneratorExpression ge;
cmsys::auto_ptr<cmCompiledGeneratorExpression> cmsys::auto_ptr<cmCompiledGeneratorExpression>
cge = ge.Parse(propertyValue); cge = ge.Parse(propertyValue);
cmGeneratorTarget* gt = this->GetGeneratorTarget(target); if(cmSystemTools::IsOn(cge->Evaluate(target->GetLocalGenerator(),
if(cmSystemTools::IsOn(cge->Evaluate(gt->GetLocalGenerator(), *i))) *i)))
{ {
activeConfigs.insert(*i); activeConfigs.insert(*i);
} }
@ -1029,13 +1030,12 @@ cmGlobalVisualStudio7Generator::IsPartOfDefaultBuild(
{ {
return activeConfigs; return activeConfigs;
} }
cmGeneratorTarget* gt = this->GetGeneratorTarget(target);
// inspect EXCLUDE_FROM_DEFAULT_BUILD[_<CONFIG>] properties // inspect EXCLUDE_FROM_DEFAULT_BUILD[_<CONFIG>] properties
for(std::vector<std::string>::const_iterator i = configs.begin(); for(std::vector<std::string>::const_iterator i = configs.begin();
i != configs.end(); ++i) i != configs.end(); ++i)
{ {
const char* propertyValue = const char* propertyValue =
gt->GetFeature("EXCLUDE_FROM_DEFAULT_BUILD", i->c_str()); target->GetFeature("EXCLUDE_FROM_DEFAULT_BUILD", i->c_str());
if(cmSystemTools::IsOff(propertyValue)) if(cmSystemTools::IsOff(propertyValue))
{ {
activeConfigs.insert(*i); activeConfigs.insert(*i);
@ -1047,9 +1047,8 @@ cmGlobalVisualStudio7Generator::IsPartOfDefaultBuild(
bool bool
cmGlobalVisualStudio7Generator cmGlobalVisualStudio7Generator
::IsDependedOn(OrderedTargetDependSet const& projectTargets, ::IsDependedOn(OrderedTargetDependSet const& projectTargets,
cmTarget const* targetIn) cmGeneratorTarget const* gtIn)
{ {
cmGeneratorTarget* gtIn = this->GetGeneratorTarget(targetIn);
for (OrderedTargetDependSet::const_iterator l = projectTargets.begin(); for (OrderedTargetDependSet::const_iterator l = projectTargets.begin();
l != projectTargets.end(); ++l) l != projectTargets.end(); ++l)
{ {

View File

@ -163,9 +163,9 @@ protected:
std::set<std::string> std::set<std::string>
IsPartOfDefaultBuild(std::vector<std::string> const& configs, IsPartOfDefaultBuild(std::vector<std::string> const& configs,
OrderedTargetDependSet const& projectTargets, OrderedTargetDependSet const& projectTargets,
cmTarget const* target); cmGeneratorTarget const* target);
bool IsDependedOn(OrderedTargetDependSet const& projectTargets, bool IsDependedOn(OrderedTargetDependSet const& projectTargets,
cmTarget const* target); cmGeneratorTarget const* target);
std::map<std::string, std::string> GUIDMap; std::map<std::string, std::string> GUIDMap;
virtual void WriteFolders(std::ostream& fout); virtual void WriteFolders(std::ostream& fout);

View File

@ -257,7 +257,6 @@ bool cmGlobalVisualStudio8Generator::AddCheckTarget()
cmGeneratorTarget* gt = new cmGeneratorTarget(tgt, lg); cmGeneratorTarget* gt = new cmGeneratorTarget(tgt, lg);
lg->AddGeneratorTarget(gt); lg->AddGeneratorTarget(gt);
this->AddGeneratorTarget(tgt, gt);
// Organize in the "predefined targets" folder: // Organize in the "predefined targets" folder:
// //
@ -354,14 +353,18 @@ void cmGlobalVisualStudio8Generator::AddExtraIDETargets()
cmGlobalVisualStudio7Generator::AddExtraIDETargets(); cmGlobalVisualStudio7Generator::AddExtraIDETargets();
if(this->AddCheckTarget()) if(this->AddCheckTarget())
{ {
// All targets depend on the build-system check target. for (unsigned int i = 0; i < this->LocalGenerators.size(); ++i)
for(TargetMap::const_iterator
ti = this->TotalTargets.begin();
ti != this->TotalTargets.end(); ++ti)
{ {
if(ti->first != CMAKE_CHECK_BUILD_SYSTEM_TARGET) std::vector<cmGeneratorTarget*> tgts =
this->LocalGenerators[i]->GetGeneratorTargets();
// All targets depend on the build-system check target.
for(std::vector<cmGeneratorTarget*>::iterator ti = tgts.begin();
ti != tgts.end(); ++ti)
{ {
ti->second->AddUtility(CMAKE_CHECK_BUILD_SYSTEM_TARGET); if((*ti)->GetName() != CMAKE_CHECK_BUILD_SYSTEM_TARGET)
{
(*ti)->Target->AddUtility(CMAKE_CHECK_BUILD_SYSTEM_TARGET);
}
} }
} }
} }
@ -464,8 +467,8 @@ bool cmGlobalVisualStudio8Generator::NeedLinkLibraryDependencies(
{ {
// Look for utility dependencies that magically link. // Look for utility dependencies that magically link.
for(std::set<std::string>::const_iterator ui = for(std::set<std::string>::const_iterator ui =
target->Target->GetUtilities().begin(); target->GetUtilities().begin();
ui != target->Target->GetUtilities().end(); ++ui) ui != target->GetUtilities().end(); ++ui)
{ {
if(cmGeneratorTarget* depTarget = if(cmGeneratorTarget* depTarget =
target->GetLocalGenerator()->FindGeneratorTargetToUse(ui->c_str())) target->GetLocalGenerator()->FindGeneratorTargetToUse(ui->c_str()))

View File

@ -88,7 +88,6 @@ void cmGlobalVisualStudioGenerator::AddExtraIDETargets()
cmGeneratorTarget* gt = new cmGeneratorTarget(allBuild, gen[0]); cmGeneratorTarget* gt = new cmGeneratorTarget(allBuild, gen[0]);
gen[0]->AddGeneratorTarget(gt); gen[0]->AddGeneratorTarget(gt);
this->AddGeneratorTarget(allBuild, gt);
#if 0 #if 0
// Can't activate this code because we want ALL_BUILD // Can't activate this code because we want ALL_BUILD

View File

@ -460,7 +460,6 @@ cmGlobalXCodeGenerator::AddExtraTargets(cmLocalGenerator* root,
cmGeneratorTarget* allBuildGt = new cmGeneratorTarget(allbuild, root); cmGeneratorTarget* allBuildGt = new cmGeneratorTarget(allbuild, root);
root->AddGeneratorTarget(allBuildGt); root->AddGeneratorTarget(allBuildGt);
root->GetGlobalGenerator()->AddGeneratorTarget(allbuild, allBuildGt);
// Refer to the main build configuration file for easy editing. // Refer to the main build configuration file for easy editing.
std::string listfile = root->GetCurrentSourceDirectory(); std::string listfile = root->GetCurrentSourceDirectory();
@ -496,7 +495,6 @@ cmGlobalXCodeGenerator::AddExtraTargets(cmLocalGenerator* root,
cmGeneratorTarget* checkGt = new cmGeneratorTarget(check, root); cmGeneratorTarget* checkGt = new cmGeneratorTarget(check, root);
root->AddGeneratorTarget(checkGt); root->AddGeneratorTarget(checkGt);
root->GetGlobalGenerator()->AddGeneratorTarget(check, checkGt);
} }
// now make the allbuild depend on all the non-utility targets // now make the allbuild depend on all the non-utility targets
@ -1362,12 +1360,17 @@ cmGlobalXCodeGenerator::CreateXCodeTargets(cmLocalGenerator* gen,
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void cmGlobalXCodeGenerator::ForceLinkerLanguages() void cmGlobalXCodeGenerator::ForceLinkerLanguages()
{ {
// This makes sure all targets link using the proper language. for (unsigned int i = 0; i < this->LocalGenerators.size(); ++i)
for(TargetMap::const_iterator
ti = this->TotalTargets.begin(); ti != this->TotalTargets.end(); ++ti)
{ {
cmGeneratorTarget* gt = this->GetGeneratorTarget(ti->second); std::vector<cmGeneratorTarget*> tgts =
this->ForceLinkerLanguage(gt); this->LocalGenerators[i]->GetGeneratorTargets();
// All targets depend on the build-system check target.
for(std::vector<cmGeneratorTarget*>::const_iterator ti = tgts.begin();
ti != tgts.end(); ++ti)
{
// This makes sure all targets link using the proper language.
this->ForceLinkerLanguage(*ti);
}
} }
} }
@ -1420,7 +1423,7 @@ void cmGlobalXCodeGenerator::ForceLinkerLanguage(cmGeneratorTarget* gtgt)
bool cmGlobalXCodeGenerator::IsHeaderFile(cmSourceFile* sf) bool cmGlobalXCodeGenerator::IsHeaderFile(cmSourceFile* sf)
{ {
const std::vector<std::string>& hdrExts = const std::vector<std::string>& hdrExts =
this->CurrentMakefile->GetHeaderExtensions(); this->CMakeInstance->GetHeaderExtensions();
return (std::find(hdrExts.begin(), hdrExts.end(), sf->GetExtension()) != return (std::find(hdrExts.begin(), hdrExts.end(), sf->GetExtension()) !=
hdrExts.end()); hdrExts.end());
} }
@ -1469,11 +1472,11 @@ void cmGlobalXCodeGenerator::CreateCustomCommands(cmXCodeObject* buildPhases,
cmGeneratorTarget* gtgt) cmGeneratorTarget* gtgt)
{ {
std::vector<cmCustomCommand> const & prebuild std::vector<cmCustomCommand> const & prebuild
= gtgt->Target->GetPreBuildCommands(); = gtgt->GetPreBuildCommands();
std::vector<cmCustomCommand> const & prelink std::vector<cmCustomCommand> const & prelink
= gtgt->Target->GetPreLinkCommands(); = gtgt->GetPreLinkCommands();
std::vector<cmCustomCommand> postbuild std::vector<cmCustomCommand> postbuild
= gtgt->Target->GetPostBuildCommands(); = gtgt->GetPostBuildCommands();
if(gtgt->GetType() == cmState::SHARED_LIBRARY && if(gtgt->GetType() == cmState::SHARED_LIBRARY &&
!gtgt->IsFrameworkOnApple()) !gtgt->IsFrameworkOnApple())
@ -2141,7 +2144,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt,
{ {
if(gtgt->GetPropertyAsBool("FRAMEWORK")) if(gtgt->GetPropertyAsBool("FRAMEWORK"))
{ {
std::string fw_version = gtgt->Target->GetFrameworkVersion(); std::string fw_version = gtgt->GetFrameworkVersion();
buildSettings->AddAttribute("FRAMEWORK_VERSION", buildSettings->AddAttribute("FRAMEWORK_VERSION",
this->CreateString(fw_version.c_str())); this->CreateString(fw_version.c_str()));
@ -2486,13 +2489,13 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt,
// put this last so it can override existing settings // put this last so it can override existing settings
// Convert "XCODE_ATTRIBUTE_*" properties directly. // Convert "XCODE_ATTRIBUTE_*" properties directly.
{ {
cmPropertyMap const& props = gtgt->Target->GetProperties(); std::vector<std::string> const& props = gtgt->GetPropertyKeys();
for(cmPropertyMap::const_iterator i = props.begin(); for(std::vector<std::string>::const_iterator i = props.begin();
i != props.end(); ++i) i != props.end(); ++i)
{ {
if(i->first.find("XCODE_ATTRIBUTE_") == 0) if(i->find("XCODE_ATTRIBUTE_") == 0)
{ {
std::string attribute = i->first.substr(16); std::string attribute = i->substr(16);
// Handle [variant=<config>] condition explicitly here. // Handle [variant=<config>] condition explicitly here.
std::string::size_type beginVariant = std::string::size_type beginVariant =
attribute.find("[variant="); attribute.find("[variant=");
@ -2523,7 +2526,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt,
if (!attribute.empty()) if (!attribute.empty())
{ {
cmGeneratorExpression ge; cmGeneratorExpression ge;
std::string processed = ge.Parse(i->second.GetValue()) std::string processed = ge.Parse(gtgt->GetProperty(*i))
->Evaluate(this->CurrentLocalGenerator, configName); ->Evaluate(this->CurrentLocalGenerator, configName);
buildSettings->AddAttribute(attribute.c_str(), buildSettings->AddAttribute(attribute.c_str(),
this->CreateString(processed)); this->CreateString(processed));

View File

@ -51,6 +51,8 @@ cmLocalGenerator::cmLocalGenerator(cmGlobalGenerator* gg,
this->Makefile = makefile; this->Makefile = makefile;
this->AliasTargets = makefile->GetAliasTargets();
this->EmitUniversalBinaryFlags = true; this->EmitUniversalBinaryFlags = true;
this->BackwardsCompatibility = 0; this->BackwardsCompatibility = 0;
this->BackwardsCompatibilityFinal = false; this->BackwardsCompatibilityFinal = false;
@ -60,6 +62,8 @@ cmLocalGenerator::cmLocalGenerator(cmGlobalGenerator* gg,
cmLocalGenerator::~cmLocalGenerator() cmLocalGenerator::~cmLocalGenerator()
{ {
cmDeleteAll(this->GeneratorTargets);
cmDeleteAll(this->OwnedImportedGeneratorTargets);
} }
void cmLocalGenerator::IssueMessage(cmake::MessageType t, void cmLocalGenerator::IssueMessage(cmake::MessageType t,
@ -453,11 +457,55 @@ void cmLocalGenerator::AddGeneratorTarget(cmGeneratorTarget* gt)
this->GeneratorTargets.push_back(gt); this->GeneratorTargets.push_back(gt);
} }
void cmLocalGenerator::AddImportedGeneratorTarget(cmGeneratorTarget* gt)
{
this->ImportedGeneratorTargets.push_back(gt);
}
void cmLocalGenerator::AddOwnedImportedGeneratorTarget(cmGeneratorTarget* gt)
{
this->OwnedImportedGeneratorTargets.push_back(gt);
}
struct NamedGeneratorTargetFinder
{
NamedGeneratorTargetFinder(std::string const& name)
: Name(name)
{
}
bool operator()(cmGeneratorTarget* tgt)
{
return tgt->GetName() == this->Name;
}
private:
std::string Name;
};
cmGeneratorTarget* cmLocalGenerator::FindGeneratorTarget( cmGeneratorTarget* cmLocalGenerator::FindGeneratorTarget(
const std::string& name) const const std::string& name) const
{ {
return this->GetGlobalGenerator()->GetGeneratorTarget( std::map<std::string, std::string>::const_iterator i =
this->Makefile->FindTarget(name)); this->AliasTargets.find(name);
if (i != this->AliasTargets.end())
{
std::vector<cmGeneratorTarget*>::const_iterator ai =
std::find_if(this->GeneratorTargets.begin(),
this->GeneratorTargets.end(),
NamedGeneratorTargetFinder(i->second));
return *ai;
}
std::vector<cmGeneratorTarget*>::const_iterator ti =
std::find_if(this->GeneratorTargets.begin(),
this->GeneratorTargets.end(),
NamedGeneratorTargetFinder(name));
if ( ti != this->GeneratorTargets.end() )
{
return *ti;
}
return 0;
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
@ -490,6 +538,11 @@ void cmLocalGenerator::ComputeTargetManifest()
} }
} }
bool cmLocalGenerator::IsRootMakefile() const
{
return !this->StateSnapshot.GetBuildsystemDirectoryParent().IsValid();
}
cmState* cmLocalGenerator::GetState() const cmState* cmLocalGenerator::GetState() const
{ {
return this->GlobalGenerator->GetCMakeInstance()->GetState(); return this->GlobalGenerator->GetCMakeInstance()->GetState();
@ -1775,11 +1828,21 @@ void cmLocalGenerator::AddLanguageFlags(std::string& flags,
cmGeneratorTarget* cmGeneratorTarget*
cmLocalGenerator::FindGeneratorTargetToUse(const std::string& name) const cmLocalGenerator::FindGeneratorTargetToUse(const std::string& name) const
{ {
if (cmTarget *t = this->Makefile->FindTargetToUse(name)) std::vector<cmGeneratorTarget*>::const_iterator
imported = std::find_if(this->ImportedGeneratorTargets.begin(),
this->ImportedGeneratorTargets.end(),
NamedGeneratorTargetFinder(name));
if(imported != this->ImportedGeneratorTargets.end())
{ {
return this->GetGlobalGenerator()->GetGeneratorTarget(t); return *imported;
} }
return 0;
if(cmGeneratorTarget* t = this->FindGeneratorTarget(name))
{
return t;
}
return this->GetGlobalGenerator()->FindGeneratorTarget(name);
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
@ -2028,7 +2091,7 @@ AddCompilerRequirementFlag(std::string &flags,
} }
static void AddVisibilityCompileOption(std::string &flags, static void AddVisibilityCompileOption(std::string &flags,
cmTarget const* target, cmGeneratorTarget const* target,
cmLocalGenerator *lg, cmLocalGenerator *lg,
const std::string& lang, const std::string& lang,
std::string* warnCMP0063) std::string* warnCMP0063)
@ -2068,7 +2131,7 @@ static void AddVisibilityCompileOption(std::string &flags,
} }
static void AddInlineVisibilityCompileOption(std::string &flags, static void AddInlineVisibilityCompileOption(std::string &flags,
cmTarget const* target, cmGeneratorTarget const* target,
cmLocalGenerator *lg, cmLocalGenerator *lg,
std::string* warnCMP0063) std::string* warnCMP0063)
{ {
@ -2121,12 +2184,11 @@ void cmLocalGenerator
} }
} }
AddVisibilityCompileOption(flags, target->Target, this, lang, pWarnCMP0063); AddVisibilityCompileOption(flags, target, this, lang, pWarnCMP0063);
if(lang == "CXX") if(lang == "CXX")
{ {
AddInlineVisibilityCompileOption(flags, target->Target, AddInlineVisibilityCompileOption(flags, target, this, pWarnCMP0063);
this, pWarnCMP0063);
} }
if (!warnCMP0063.empty() && if (!warnCMP0063.empty() &&
@ -2201,7 +2263,7 @@ bool cmLocalGenerator::GetShouldUseOldFlags(bool shared,
if (flags && flags != originalFlags) if (flags && flags != originalFlags)
{ {
switch (this->Makefile->GetPolicyStatus(cmPolicies::CMP0018)) switch (this->GetPolicyStatus(cmPolicies::CMP0018))
{ {
case cmPolicies::WARN: case cmPolicies::WARN:
{ {
@ -2949,7 +3011,7 @@ bool cmLocalGenerator::NeedBackwardsCompatibility_2_4()
{ {
// Check the policy to decide whether to pay attention to this // Check the policy to decide whether to pay attention to this
// variable. // variable.
switch(this->Makefile->GetPolicyStatus(cmPolicies::CMP0001)) switch(this->GetPolicyStatus(cmPolicies::CMP0001))
{ {
case cmPolicies::WARN: case cmPolicies::WARN:
// WARN is just OLD without warning because user code does not // WARN is just OLD without warning because user code does not
@ -2976,6 +3038,12 @@ bool cmLocalGenerator::NeedBackwardsCompatibility_2_4()
actual_compat <= CMake_VERSION_ENCODE(2, 4, 255)); actual_compat <= CMake_VERSION_ENCODE(2, 4, 255));
} }
cmPolicies::PolicyStatus
cmLocalGenerator::GetPolicyStatus(cmPolicies::PolicyID id) const
{
return this->Makefile->GetPolicyStatus(id);
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
bool cmLocalGenerator::CheckDefinition(std::string const& define) const bool cmLocalGenerator::CheckDefinition(std::string const& define) const
{ {

View File

@ -67,6 +67,8 @@ public:
*/ */
void ComputeTargetManifest(); void ComputeTargetManifest();
bool IsRootMakefile() const;
///! Get the makefile for this generator ///! Get the makefile for this generator
cmMakefile *GetMakefile() { cmMakefile *GetMakefile() {
return this->Makefile; } return this->Makefile; }
@ -118,7 +120,14 @@ public:
return this->GeneratorTargets; return this->GeneratorTargets;
} }
const std::vector<cmGeneratorTarget*> &GetImportedGeneratorTargets() const
{
return this->ImportedGeneratorTargets;
}
void AddGeneratorTarget(cmGeneratorTarget* gt); void AddGeneratorTarget(cmGeneratorTarget* gt);
void AddImportedGeneratorTarget(cmGeneratorTarget* gt);
void AddOwnedImportedGeneratorTarget(cmGeneratorTarget* gt);
cmGeneratorTarget* FindGeneratorTarget(const std::string& name) const; cmGeneratorTarget* FindGeneratorTarget(const std::string& name) const;
cmGeneratorTarget* FindGeneratorTargetToUse(const std::string& name) const; cmGeneratorTarget* FindGeneratorTargetToUse(const std::string& name) const;
@ -265,6 +274,8 @@ public:
*/ */
bool NeedBackwardsCompatibility_2_4(); bool NeedBackwardsCompatibility_2_4();
cmPolicies::PolicyStatus GetPolicyStatus(cmPolicies::PolicyID id) const;
cmake* GetCMakeInstance() const; cmake* GetCMakeInstance() const;
const char* GetSourceDirectory() const; const char* GetSourceDirectory() const;
@ -369,6 +380,9 @@ protected:
std::set<cmGeneratorTarget const*> WarnCMP0063; std::set<cmGeneratorTarget const*> WarnCMP0063;
std::vector<cmGeneratorTarget*> GeneratorTargets; std::vector<cmGeneratorTarget*> GeneratorTargets;
std::vector<cmGeneratorTarget*> ImportedGeneratorTargets;
std::vector<cmGeneratorTarget*> OwnedImportedGeneratorTargets;
std::map<std::string, std::string> AliasTargets;
bool EmitUniversalBinaryFlags; bool EmitUniversalBinaryFlags;

View File

@ -56,7 +56,7 @@ void cmLocalNinjaGenerator::Generate()
#endif #endif
// We do that only once for the top CMakeLists.txt file. // We do that only once for the top CMakeLists.txt file.
if(this->Makefile->IsRootMakefile()) if(this->IsRootMakefile())
{ {
this->WriteBuildFileTop(); this->WriteBuildFileTop();
@ -277,7 +277,7 @@ void cmLocalNinjaGenerator::WriteProcessedMakefile(std::ostream& os)
<< "# Write statements declared in CMakeLists.txt:" << std::endl << "# Write statements declared in CMakeLists.txt:" << std::endl
<< "# " << "# "
<< this->Makefile->GetDefinition("CMAKE_CURRENT_LIST_FILE") << std::endl; << this->Makefile->GetDefinition("CMAKE_CURRENT_LIST_FILE") << std::endl;
if(this->Makefile->IsRootMakefile()) if(this->IsRootMakefile())
os << "# Which is the root file." << std::endl; os << "# Which is the root file." << std::endl;
cmGlobalNinjaGenerator::WriteDivider(os); cmGlobalNinjaGenerator::WriteDivider(os);
os << std::endl; os << std::endl;

View File

@ -254,7 +254,7 @@ void cmLocalUnixMakefileGenerator3::WriteLocalMakefile()
return; return;
} }
// always write the top makefile // always write the top makefile
if (!this->GetMakefile()->IsRootMakefile()) if (!this->IsRootMakefile())
{ {
ruleFileStream.SetCopyIfDifferent(true); ruleFileStream.SetCopyIfDifferent(true);
} }
@ -265,7 +265,7 @@ void cmLocalUnixMakefileGenerator3::WriteLocalMakefile()
// only write local targets unless at the top Keep track of targets already // only write local targets unless at the top Keep track of targets already
// listed. // listed.
std::set<std::string> emittedTargets; std::set<std::string> emittedTargets;
if (!this->GetMakefile()->IsRootMakefile()) if (!this->IsRootMakefile())
{ {
// write our targets, and while doing it collect up the object // write our targets, and while doing it collect up the object
// file rules // file rules
@ -880,7 +880,7 @@ void cmLocalUnixMakefileGenerator3
std::vector<std::string> no_depends; std::vector<std::string> no_depends;
std::vector<std::string> commands; std::vector<std::string> commands;
commands.push_back(runRule); commands.push_back(runRule);
if(!this->GetMakefile()->IsRootMakefile()) if(!this->IsRootMakefile())
{ {
this->CreateCDCommand(commands, this->CreateCDCommand(commands,
this->GetBinaryDirectory(), this->GetBinaryDirectory(),
@ -1778,8 +1778,8 @@ void cmLocalUnixMakefileGenerator3
{ {
text = "Running external command ..."; text = "Running external command ...";
} }
depends.insert(depends.end(), (*glIt)->Target->GetUtilities().begin(), depends.insert(depends.end(), (*glIt)->GetUtilities().begin(),
(*glIt)->Target->GetUtilities().end()); (*glIt)->GetUtilities().end());
this->AppendEcho(commands, text, this->AppendEcho(commands, text,
cmLocalUnixMakefileGenerator3::EchoGlobal); cmLocalUnixMakefileGenerator3::EchoGlobal);
@ -1787,15 +1787,15 @@ void cmLocalUnixMakefileGenerator3
// 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,
gt->Target->GetPreBuildCommands()); gt->GetPreBuildCommands());
this->AppendCustomDepends(depends, this->AppendCustomDepends(depends,
gt->Target->GetPostBuildCommands()); gt->GetPostBuildCommands());
this->AppendCustomCommands(commands, this->AppendCustomCommands(commands,
gt->Target->GetPreBuildCommands(), gt->GetPreBuildCommands(),
gt, gt,
cmLocalGenerator::START_OUTPUT); cmLocalGenerator::START_OUTPUT);
this->AppendCustomCommands(commands, this->AppendCustomCommands(commands,
gt->Target->GetPostBuildCommands(), gt->GetPostBuildCommands(),
gt, gt,
cmLocalGenerator::START_OUTPUT); cmLocalGenerator::START_OUTPUT);
std::string targetName = gt->GetName(); std::string targetName = gt->GetName();

View File

@ -266,21 +266,21 @@ void cmLocalVisualStudio6Generator::WriteDSPFile(std::ostream& fout,
// depend only on the previous rule. // depend only on the previous rule.
if ((target->GetType() == cmState::UTILITY || if ((target->GetType() == cmState::UTILITY ||
target->GetType() == cmState::GLOBAL_TARGET) && target->GetType() == cmState::GLOBAL_TARGET) &&
(!target->Target->GetPreBuildCommands().empty() || (!target->GetPreBuildCommands().empty() ||
!target->Target->GetPostBuildCommands().empty())) !target->GetPostBuildCommands().empty()))
{ {
// Accumulate the dependencies of all the commands. // Accumulate the dependencies of all the commands.
std::vector<std::string> depends; std::vector<std::string> depends;
for (std::vector<cmCustomCommand>::const_iterator cr = for (std::vector<cmCustomCommand>::const_iterator cr =
target->Target->GetPreBuildCommands().begin(); target->GetPreBuildCommands().begin();
cr != target->Target->GetPreBuildCommands().end(); ++cr) cr != target->GetPreBuildCommands().end(); ++cr)
{ {
depends.insert(depends.end(), depends.insert(depends.end(),
cr->GetDepends().begin(), cr->GetDepends().end()); cr->GetDepends().begin(), cr->GetDepends().end());
} }
for (std::vector<cmCustomCommand>::const_iterator cr = for (std::vector<cmCustomCommand>::const_iterator cr =
target->Target->GetPostBuildCommands().begin(); target->GetPostBuildCommands().begin();
cr != target->Target->GetPostBuildCommands().end(); ++cr) cr != target->GetPostBuildCommands().end(); ++cr)
{ {
depends.insert(depends.end(), depends.insert(depends.end(),
cr->GetDepends().begin(), cr->GetDepends().end()); cr->GetDepends().begin(), cr->GetDepends().end());
@ -289,14 +289,14 @@ void cmLocalVisualStudio6Generator::WriteDSPFile(std::ostream& fout,
// Add the pre- and post-build commands in order. // Add the pre- and post-build commands in order.
int count = 1; int count = 1;
for (std::vector<cmCustomCommand>::const_iterator cr = for (std::vector<cmCustomCommand>::const_iterator cr =
target->Target->GetPreBuildCommands().begin(); target->GetPreBuildCommands().begin();
cr != target->Target->GetPreBuildCommands().end(); ++cr) cr != target->GetPreBuildCommands().end(); ++cr)
{ {
this->AddUtilityCommandHack(target, count++, depends, *cr); this->AddUtilityCommandHack(target, count++, depends, *cr);
} }
for (std::vector<cmCustomCommand>::const_iterator cr = for (std::vector<cmCustomCommand>::const_iterator cr =
target->Target->GetPostBuildCommands().begin(); target->GetPostBuildCommands().begin();
cr != target->Target->GetPostBuildCommands().end(); ++cr) cr != target->GetPostBuildCommands().end(); ++cr)
{ {
this->AddUtilityCommandHack(target, count++, depends, *cr); this->AddUtilityCommandHack(target, count++, depends, *cr);
} }
@ -838,8 +838,8 @@ cmLocalVisualStudio6Generator::CreateTargetRules(cmGeneratorTarget *target,
// Write the pre-build and pre-link together (VS6 does not support both). // Write the pre-build and pre-link together (VS6 does not support both).
event.Start("PreLink"); event.Start("PreLink");
event.Write(target->Target->GetPreBuildCommands()); event.Write(target->GetPreBuildCommands());
event.Write(target->Target->GetPreLinkCommands()); event.Write(target->GetPreLinkCommands());
cmsys::auto_ptr<cmCustomCommand> pcc( cmsys::auto_ptr<cmCustomCommand> pcc(
this->MaybeCreateImplibDir(target, configName, false)); this->MaybeCreateImplibDir(target, configName, false));
if(pcc.get()) if(pcc.get())
@ -855,7 +855,7 @@ cmLocalVisualStudio6Generator::CreateTargetRules(cmGeneratorTarget *target,
// Write the post-build rules. // Write the post-build rules.
event.Start("PostBuild"); event.Start("PostBuild");
event.Write(target->Target->GetPostBuildCommands()); event.Write(target->GetPostBuildCommands());
event.Finish(); event.Finish();
customRuleCode += "# End Special Build Tool\n"; customRuleCode += "# End Special Build Tool\n";
@ -1052,7 +1052,7 @@ void cmLocalVisualStudio6Generator
} }
std::vector<std::string>::const_iterator i; std::vector<std::string>::const_iterator i;
const std::vector<std::string>& libdirs = const std::vector<std::string>& libdirs =
target->Target->GetLinkDirectories(); target->GetLinkDirectories();
for(i = libdirs.begin(); i != libdirs.end(); ++i) for(i = libdirs.begin(); i != libdirs.end(); ++i)
{ {
std::string path = *i; std::string path = *i;
@ -1112,15 +1112,14 @@ void cmLocalVisualStudio6Generator
// Compute the proper name to use to link this library. // Compute the proper name to use to link this library.
std::string lib; std::string lib;
std::string libDebug; std::string libDebug;
cmTarget* tgt = this->GlobalGenerator->FindTarget(j->first.c_str()); cmGeneratorTarget* tgt =
this->GlobalGenerator->FindGeneratorTarget(j->first.c_str());
if(tgt) if(tgt)
{ {
cmGeneratorTarget* gt =
this->GlobalGenerator->GetGeneratorTarget(tgt);
lib = cmSystemTools::GetFilenameWithoutExtension lib = cmSystemTools::GetFilenameWithoutExtension
(gt->GetFullName().c_str()); (tgt->GetFullName().c_str());
libDebug = cmSystemTools::GetFilenameWithoutExtension libDebug = cmSystemTools::GetFilenameWithoutExtension
(gt->GetFullName("Debug").c_str()); (tgt->GetFullName("Debug").c_str());
lib += ".lib"; lib += ".lib";
libDebug += ".lib"; libDebug += ".lib";
} }

View File

@ -783,10 +783,10 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout,
intermediateDir += "/"; intermediateDir += "/";
intermediateDir += configName; intermediateDir += configName;
if (target->Target->GetType() < cmState::UTILITY) if (target->GetType() < cmState::UTILITY)
{ {
std::string const& outDir = std::string const& outDir =
target->Target->GetType() == cmState::OBJECT_LIBRARY? target->GetType() == cmState::OBJECT_LIBRARY?
intermediateDir : target->GetDirectory(configName); intermediateDir : target->GetDirectory(configName);
fout << "\t\t\tOutputDirectory=\"" fout << "\t\t\tOutputDirectory=\""
<< this->ConvertToXMLOutputPathSingle(outDir.c_str()) << "\"\n"; << this->ConvertToXMLOutputPathSingle(outDir.c_str()) << "\"\n";
@ -837,7 +837,7 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout,
if(this->FortranProject) if(this->FortranProject)
{ {
const char* target_mod_dir = const char* target_mod_dir =
target->Target->GetProperty("Fortran_MODULE_DIRECTORY"); target->GetProperty("Fortran_MODULE_DIRECTORY");
std::string modDir; std::string modDir;
if(target_mod_dir) if(target_mod_dir)
{ {
@ -877,7 +877,7 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout,
targetOptions.OutputFlagMap(fout, "\t\t\t\t"); targetOptions.OutputFlagMap(fout, "\t\t\t\t");
targetOptions.OutputPreprocessorDefinitions(fout, "\t\t\t\t", "\n", "CXX"); targetOptions.OutputPreprocessorDefinitions(fout, "\t\t\t\t", "\n", "CXX");
fout << "\t\t\t\tObjectFile=\"$(IntDir)\\\"\n"; fout << "\t\t\t\tObjectFile=\"$(IntDir)\\\"\n";
if(target->Target->GetType() <= cmState::OBJECT_LIBRARY) if(target->GetType() <= cmState::OBJECT_LIBRARY)
{ {
// Specify the compiler program database file if configured. // Specify the compiler program database file if configured.
std::string pdb = target->GetCompilePDBPath(configName); std::string pdb = target->GetCompilePDBPath(configName);
@ -2021,7 +2021,7 @@ void cmLocalVisualStudio7Generator
const char* tool = const char* tool =
this->FortranProject? "VFPreBuildEventTool":"VCPreBuildEventTool"; this->FortranProject? "VFPreBuildEventTool":"VCPreBuildEventTool";
event.Start(tool); event.Start(tool);
event.Write(target->Target->GetPreBuildCommands()); event.Write(target->GetPreBuildCommands());
event.Finish(); event.Finish();
// Add pre-link event. // Add pre-link event.
@ -2035,7 +2035,7 @@ void cmLocalVisualStudio7Generator
{ {
addedPrelink = true; addedPrelink = true;
std::vector<cmCustomCommand> commands = std::vector<cmCustomCommand> commands =
target->Target->GetPreLinkCommands(); target->GetPreLinkCommands();
cmGlobalVisualStudioGenerator* gg cmGlobalVisualStudioGenerator* gg
= static_cast<cmGlobalVisualStudioGenerator*>(this->GlobalGenerator); = static_cast<cmGlobalVisualStudioGenerator*>(this->GlobalGenerator);
gg->AddSymbolExportCommand( gg->AddSymbolExportCommand(
@ -2045,7 +2045,7 @@ void cmLocalVisualStudio7Generator
} }
if (!addedPrelink) if (!addedPrelink)
{ {
event.Write(target->Target->GetPreLinkCommands()); event.Write(target->GetPreLinkCommands());
} }
cmsys::auto_ptr<cmCustomCommand> pcc( cmsys::auto_ptr<cmCustomCommand> pcc(
this->MaybeCreateImplibDir(target, this->MaybeCreateImplibDir(target,
@ -2059,7 +2059,7 @@ void cmLocalVisualStudio7Generator
// Add post-build event. // Add post-build event.
tool = this->FortranProject? "VFPostBuildEventTool":"VCPostBuildEventTool"; tool = this->FortranProject? "VFPostBuildEventTool":"VCPostBuildEventTool";
event.Start(tool); event.Start(tool);
event.Write(target->Target->GetPostBuildCommands()); event.Write(target->GetPostBuildCommands());
event.Finish(); event.Finish();
} }
@ -2219,17 +2219,18 @@ void cmLocalVisualStudio7Generator::WriteVCProjFooter(
{ {
fout << "\t<Globals>\n"; fout << "\t<Globals>\n";
cmPropertyMap const& props = target->Target->GetProperties(); std::vector<std::string> const& props = target->GetPropertyKeys();
for(cmPropertyMap::const_iterator i = props.begin(); i != props.end(); ++i) for(std::vector<std::string>::const_iterator i = props.begin();
i != props.end(); ++i)
{ {
if(i->first.find("VS_GLOBAL_") == 0) if(i->find("VS_GLOBAL_") == 0)
{ {
std::string name = i->first.substr(10); std::string name = i->substr(10);
if(name != "") if(name != "")
{ {
fout << "\t\t<Global\n" fout << "\t\t<Global\n"
<< "\t\t\tName=\"" << name << "\"\n" << "\t\t\tName=\"" << name << "\"\n"
<< "\t\t\tValue=\"" << i->second.GetValue() << "\"\n" << "\t\t\tValue=\"" << target->GetProperty(*i) << "\"\n"
<< "\t\t/>\n"; << "\t\t/>\n";
} }
} }

View File

@ -51,13 +51,11 @@ void cmLocalXCodeGenerator::Generate()
{ {
cmLocalGenerator::Generate(); cmLocalGenerator::Generate();
cmTargets& targets = this->Makefile->GetTargets(); std::vector<cmGeneratorTarget*> targets = this->GetGeneratorTargets();
for(cmTargets::iterator iter = targets.begin(); for(std::vector<cmGeneratorTarget*>::iterator iter = targets.begin();
iter != targets.end(); ++iter) iter != targets.end(); ++iter)
{ {
cmTarget* t = &iter->second; (*iter)->HasMacOSXRpathInstallNameDir("");
cmGeneratorTarget* gt = this->GlobalGenerator->GetGeneratorTarget(t);
gt->HasMacOSXRpathInstallNameDir("");
} }
} }
@ -66,13 +64,11 @@ void cmLocalXCodeGenerator::GenerateInstallRules()
{ {
cmLocalGenerator::GenerateInstallRules(); cmLocalGenerator::GenerateInstallRules();
cmTargets& targets = this->Makefile->GetTargets(); std::vector<cmGeneratorTarget*> targets = this->GetGeneratorTargets();
for(cmTargets::iterator iter = targets.begin(); for(std::vector<cmGeneratorTarget*>::iterator iter = targets.begin();
iter != targets.end(); ++iter) iter != targets.end(); ++iter)
{ {
cmTarget* t = &iter->second; (*iter)->HasMacOSXRpathInstallNameDir("");
cmGeneratorTarget* gt = this->GlobalGenerator->GetGeneratorTarget(t);
gt->HasMacOSXRpathInstallNameDir("");
} }
} }

View File

@ -57,31 +57,6 @@ cmMakefile::cmMakefile(cmGlobalGenerator* globalGenerator,
// Setup the default include complaint regular expression (match nothing). // Setup the default include complaint regular expression (match nothing).
this->ComplainFileRegularExpression = "^$"; this->ComplainFileRegularExpression = "^$";
// Source and header file extensions that we can handle
// Set up a list of source and header extensions
// these are used to find files when the extension
// is not given
// The "c" extension MUST precede the "C" extension.
this->SourceFileExtensions.push_back( "c" );
this->SourceFileExtensions.push_back( "C" );
this->SourceFileExtensions.push_back( "c++" );
this->SourceFileExtensions.push_back( "cc" );
this->SourceFileExtensions.push_back( "cpp" );
this->SourceFileExtensions.push_back( "cxx" );
this->SourceFileExtensions.push_back( "m" );
this->SourceFileExtensions.push_back( "M" );
this->SourceFileExtensions.push_back( "mm" );
this->HeaderFileExtensions.push_back( "h" );
this->HeaderFileExtensions.push_back( "hh" );
this->HeaderFileExtensions.push_back( "h++" );
this->HeaderFileExtensions.push_back( "hm" );
this->HeaderFileExtensions.push_back( "hpp" );
this->HeaderFileExtensions.push_back( "hxx" );
this->HeaderFileExtensions.push_back( "in" );
this->HeaderFileExtensions.push_back( "txx" );
this->DefineFlags = " "; this->DefineFlags = " ";
@ -756,15 +731,26 @@ void cmMakefile::ConfigureFinalPass()
"with CMake 2.4 or later. For compatibility with older versions please " "with CMake 2.4 or later. For compatibility with older versions please "
"use any CMake 2.8.x release or lower."); "use any CMake 2.8.x release or lower.");
} }
for (cmTargets::iterator l = this->Targets.begin(); #if defined(_WIN32) && !defined(__CYGWIN__)
l != this->Targets.end(); l++) // Do old-style link dependency analysis only for CM_USE_OLD_VS6.
if(this->GetGlobalGenerator()->IsForVS6())
{ {
if (l->second.GetType() == cmState::INTERFACE_LIBRARY) for (cmTargets::iterator l = this->Targets.begin();
l != this->Targets.end(); l++)
{ {
continue; if (l->second.GetType() == cmState::INTERFACE_LIBRARY)
{
continue;
}
// Erase any cached link information that might have been comptued
// on-demand during the configuration. This ensures that build
// system generation uses up-to-date information even if other cache
// invalidation code in this source file is buggy.
l->second.AnalyzeLibDependenciesForVS6(*this);
} }
l->second.FinishConfigure();
} }
#endif
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
@ -1780,6 +1766,18 @@ const char* cmMakefile::GetCurrentBinaryDirectory() const
return this->StateSnapshot.GetDirectory().GetCurrentBinary(); return this->StateSnapshot.GetDirectory().GetCurrentBinary();
} }
std::vector<cmTarget*> cmMakefile::GetImportedTargets() const
{
std::vector<cmTarget*> tgts;
tgts.reserve(this->ImportedTargets.size());
for (TargetMap::const_iterator it = this->ImportedTargets.begin();
it != this->ImportedTargets.end(); ++it)
{
tgts.push_back(it->second);
}
return tgts;
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void cmMakefile::AddIncludeDirectories(const std::vector<std::string> &incs, void cmMakefile::AddIncludeDirectories(const std::vector<std::string> &incs,
bool before) bool before)
@ -2050,10 +2048,11 @@ void cmMakefile::AddGlobalLinkInformation(const std::string& name,
} }
void cmMakefile::AddAlias(const std::string& lname, cmTarget *tgt) void cmMakefile::AddAlias(const std::string& lname,
std::string const& tgtName)
{ {
this->AliasTargets[lname] = tgt; this->AliasTargets[lname] = tgtName;
this->GetGlobalGenerator()->AddAlias(lname, tgt); this->GetGlobalGenerator()->AddAlias(lname, tgtName);
} }
cmTarget* cmMakefile::AddLibrary(const std::string& lname, cmTarget* cmMakefile::AddLibrary(const std::string& lname,
@ -2110,7 +2109,6 @@ cmMakefile::AddNewTarget(cmState::TargetType type, const std::string& name)
cmTarget& target = it->second; cmTarget& target = it->second;
target.SetType(type, name); target.SetType(type, name);
target.SetMakefile(this); target.SetMakefile(this);
this->GetGlobalGenerator()->AddTarget(&it->second);
return &it->second; return &it->second;
} }
@ -4039,10 +4037,12 @@ cmTarget* cmMakefile::FindTarget(const std::string& name,
{ {
if (!excludeAliases) if (!excludeAliases)
{ {
TargetMap::const_iterator i = this->AliasTargets.find(name); std::map<std::string, std::string>::const_iterator i =
this->AliasTargets.find(name);
if (i != this->AliasTargets.end()) if (i != this->AliasTargets.end())
{ {
return i->second; cmTargets::iterator ai = this->Targets.find(i->second);
return &ai->second;
} }
} }
cmTargets::iterator i = this->Targets.find( name ); cmTargets::iterator i = this->Targets.find( name );
@ -4197,15 +4197,11 @@ cmMakefile::AddImportedTarget(const std::string& name,
// Create the target. // Create the target.
cmsys::auto_ptr<cmTarget> target(new cmTarget); cmsys::auto_ptr<cmTarget> target(new cmTarget);
target->SetType(type, name); target->SetType(type, name);
target->MarkAsImported(); target->MarkAsImported(global);
target->SetMakefile(this); target->SetMakefile(this);
// Add to the set of available imported targets. // Add to the set of available imported targets.
this->ImportedTargets[name] = target.get(); this->ImportedTargets[name] = target.get();
if(global)
{
this->GetGlobalGenerator()->AddTarget(target.get());
}
// Transfer ownership to this cmMakefile object. // Transfer ownership to this cmMakefile object.
this->ImportedTargetsOwned.push_back(target.get()); this->ImportedTargetsOwned.push_back(target.get());

View File

@ -283,7 +283,7 @@ public:
cmTarget* AddLibrary(const std::string& libname, cmState::TargetType type, cmTarget* AddLibrary(const std::string& libname, cmState::TargetType type,
const std::vector<std::string> &srcs, const std::vector<std::string> &srcs,
bool excludeFromAll = false); bool excludeFromAll = false);
void AddAlias(const std::string& libname, cmTarget *tgt); void AddAlias(const std::string& libname, const std::string& tgt);
#if defined(CMAKE_BUILD_WITH_CMAKE) #if defined(CMAKE_BUILD_WITH_CMAKE)
/** /**
@ -390,6 +390,7 @@ public:
{ {
return this->ImportedTargetsOwned; return this->ImportedTargetsOwned;
} }
std::vector<cmTarget*> GetImportedTargets() const;
cmTarget* FindTarget(const std::string& name, cmTarget* FindTarget(const std::string& name,
bool excludeAliases = false) const; bool excludeAliases = false) const;
@ -400,6 +401,11 @@ public:
bool excludeAliases = false) const; bool excludeAliases = false) const;
bool IsAlias(const std::string& name) const; bool IsAlias(const std::string& name) const;
std::map<std::string, std::string> GetAliasTargets() const
{
return this->AliasTargets;
}
/** /**
* Mark include directories as system directories. * Mark include directories as system directories.
*/ */
@ -425,17 +431,6 @@ public:
cmSourceFile* GetOrCreateSource(const std::string& sourceName, cmSourceFile* GetOrCreateSource(const std::string& sourceName,
bool generated = false); bool generated = false);
//@{
/**
* Return a list of extensions associated with source and header
* files
*/
const std::vector<std::string>& GetSourceExtensions() const
{return this->SourceFileExtensions;}
const std::vector<std::string>& GetHeaderExtensions() const
{return this->HeaderFileExtensions;}
//@}
/** /**
* Given a variable name, return its value (as a string). * Given a variable name, return its value (as a string).
* If the variable is not found in this makefile instance, the * If the variable is not found in this makefile instance, the
@ -801,7 +796,7 @@ protected:
#else #else
typedef std::map<std::string, cmTarget*> TargetMap; typedef std::map<std::string, cmTarget*> TargetMap;
#endif #endif
TargetMap AliasTargets; std::map<std::string, std::string> AliasTargets;
std::vector<cmSourceFile*> SourceFiles; std::vector<cmSourceFile*> SourceFiles;
// Tests // Tests
@ -823,8 +818,6 @@ protected:
std::vector<cmTestGenerator*> TestGenerators; std::vector<cmTestGenerator*> TestGenerators;
std::string ComplainFileRegularExpression; std::string ComplainFileRegularExpression;
std::vector<std::string> SourceFileExtensions;
std::vector<std::string> HeaderFileExtensions;
std::string DefineFlags; std::string DefineFlags;
// Track the value of the computed DEFINITIONS property. // Track the value of the computed DEFINITIONS property.

View File

@ -279,11 +279,11 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
{ {
this->LocalGenerator this->LocalGenerator
->AppendCustomCommands(commands, ->AppendCustomCommands(commands,
this->GeneratorTarget->Target->GetPreBuildCommands(), this->GeneratorTarget->GetPreBuildCommands(),
this->GeneratorTarget); this->GeneratorTarget);
this->LocalGenerator this->LocalGenerator
->AppendCustomCommands(commands, ->AppendCustomCommands(commands,
this->GeneratorTarget->Target->GetPreLinkCommands(), this->GeneratorTarget->GetPreLinkCommands(),
this->GeneratorTarget); this->GeneratorTarget);
} }
@ -450,7 +450,7 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
{ {
this->LocalGenerator-> this->LocalGenerator->
AppendCustomCommands(commands, AppendCustomCommands(commands,
this->GeneratorTarget->Target->GetPostBuildCommands(), this->GeneratorTarget->GetPostBuildCommands(),
this->GeneratorTarget); this->GeneratorTarget);
} }

View File

@ -114,7 +114,7 @@ void cmMakefileLibraryTargetGenerator::WriteObjectLibraryRules()
// Add post-build rules. // Add post-build rules.
this->LocalGenerator-> this->LocalGenerator->
AppendCustomCommands(commands, AppendCustomCommands(commands,
this->GeneratorTarget->Target->GetPostBuildCommands(), this->GeneratorTarget->GetPostBuildCommands(),
this->GeneratorTarget); this->GeneratorTarget);
// Depend on the object files. // Depend on the object files.
@ -458,11 +458,11 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules
{ {
this->LocalGenerator this->LocalGenerator
->AppendCustomCommands(commands, ->AppendCustomCommands(commands,
this->GeneratorTarget->Target->GetPreBuildCommands(), this->GeneratorTarget->GetPreBuildCommands(),
this->GeneratorTarget); this->GeneratorTarget);
this->LocalGenerator this->LocalGenerator
->AppendCustomCommands(commands, ->AppendCustomCommands(commands,
this->GeneratorTarget->Target->GetPreLinkCommands(), this->GeneratorTarget->GetPreLinkCommands(),
this->GeneratorTarget); this->GeneratorTarget);
} }
@ -814,7 +814,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules
{ {
this->LocalGenerator-> this->LocalGenerator->
AppendCustomCommands(commands, AppendCustomCommands(commands,
this->GeneratorTarget->Target->GetPostBuildCommands(), this->GeneratorTarget->GetPostBuildCommands(),
this->GeneratorTarget); this->GeneratorTarget);
} }

View File

@ -67,20 +67,20 @@ void cmMakefileUtilityTargetGenerator::WriteRuleFiles()
// Utility targets store their rules in pre- and post-build commands. // Utility targets store their rules in pre- and post-build commands.
this->LocalGenerator->AppendCustomDepends this->LocalGenerator->AppendCustomDepends
(depends, this->GeneratorTarget->Target->GetPreBuildCommands()); (depends, this->GeneratorTarget->GetPreBuildCommands());
this->LocalGenerator->AppendCustomDepends this->LocalGenerator->AppendCustomDepends
(depends, this->GeneratorTarget->Target->GetPostBuildCommands()); (depends, this->GeneratorTarget->GetPostBuildCommands());
this->LocalGenerator->AppendCustomCommands this->LocalGenerator->AppendCustomCommands
(commands, this->GeneratorTarget->Target->GetPreBuildCommands(), (commands, this->GeneratorTarget->GetPreBuildCommands(),
this->GeneratorTarget); 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->GeneratorTarget->Target->GetPostBuildCommands(), (commands, this->GeneratorTarget->GetPostBuildCommands(),
this->GeneratorTarget); this->GeneratorTarget);
// Add dependencies on targets that must be built first. // Add dependencies on targets that must be built first.

View File

@ -598,9 +598,9 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
} }
const std::vector<cmCustomCommand> *cmdLists[3] = { const std::vector<cmCustomCommand> *cmdLists[3] = {
&gt.Target->GetPreBuildCommands(), &gt.GetPreBuildCommands(),
&gt.Target->GetPreLinkCommands(), &gt.GetPreLinkCommands(),
&gt.Target->GetPostBuildCommands() &gt.GetPostBuildCommands()
}; };
std::vector<std::string> preLinkCmdLines, postBuildCmdLines; std::vector<std::string> preLinkCmdLines, postBuildCmdLines;

View File

@ -33,8 +33,8 @@ void cmNinjaUtilityTargetGenerator::Generate()
cmNinjaDeps deps, outputs, util_outputs(1, utilCommandName); cmNinjaDeps deps, outputs, util_outputs(1, utilCommandName);
const std::vector<cmCustomCommand> *cmdLists[2] = { const std::vector<cmCustomCommand> *cmdLists[2] = {
&this->GetGeneratorTarget()->Target->GetPreBuildCommands(), &this->GetGeneratorTarget()->GetPreBuildCommands(),
&this->GetGeneratorTarget()->Target->GetPostBuildCommands() &this->GetGeneratorTarget()->GetPostBuildCommands()
}; };
bool uses_terminal = false; bool uses_terminal = false;

View File

@ -83,7 +83,7 @@ void cmOSXBundleGenerator::CreateFramework(
std::string newoutpath = outpath + "/" + std::string newoutpath = outpath + "/" +
this->GT->GetFrameworkDirectory(this->ConfigName, false); this->GT->GetFrameworkDirectory(this->ConfigName, false);
std::string frameworkVersion = this->GT->Target->GetFrameworkVersion(); std::string frameworkVersion = this->GT->GetFrameworkVersion();
// Configure the Info.plist file into the Resources directory. // Configure the Info.plist file into the Resources directory.
this->MacContentFolders->insert("Resources"); this->MacContentFolders->insert("Resources");

View File

@ -896,7 +896,6 @@ void cmQtAutoGeneratorInitializer::InitializeAutogenTarget(
cmGeneratorTarget* gt = new cmGeneratorTarget(autogenTarget, lg); cmGeneratorTarget* gt = new cmGeneratorTarget(autogenTarget, lg);
lg->AddGeneratorTarget(gt); lg->AddGeneratorTarget(gt);
lg->GetGlobalGenerator()->AddGeneratorTarget(autogenTarget, gt);
// Set target folder // Set target folder
const char* autogenFolder = makefile->GetState() const char* autogenFolder = makefile->GetState()

View File

@ -528,7 +528,7 @@ bool cmQtAutoGenerators::RunAutogen(cmMakefile* makefile)
cmSystemTools::ExpandListArgument(this->Sources, sourceFiles); cmSystemTools::ExpandListArgument(this->Sources, sourceFiles);
const std::vector<std::string>& headerExtensions = const std::vector<std::string>& headerExtensions =
makefile->GetHeaderExtensions(); makefile->GetCMakeInstance()->GetHeaderExtensions();
std::map<std::string, std::vector<std::string> > includedUis; std::map<std::string, std::vector<std::string> > includedUis;
std::map<std::string, std::vector<std::string> > skippedUis; std::map<std::string, std::vector<std::string> > skippedUis;

View File

@ -167,8 +167,10 @@ bool cmSourceFile::FindFullPath(std::string* error)
{ {
tryDirs[0] = ""; tryDirs[0] = "";
} }
const std::vector<std::string>& srcExts = mf->GetSourceExtensions(); const std::vector<std::string>& srcExts =
const std::vector<std::string>& hdrExts = mf->GetHeaderExtensions(); mf->GetCMakeInstance()->GetSourceExtensions();
std::vector<std::string> hdrExts =
mf->GetCMakeInstance()->GetHeaderExtensions();
for(const char* const* di = tryDirs; *di; ++di) for(const char* const* di = tryDirs; *di; ++di)
{ {
std::string tryPath = this->Location.GetDirectory(); std::string tryPath = this->Location.GetDirectory();

View File

@ -121,8 +121,10 @@ void cmSourceFileLocation::UpdateExtension(const std::string& name)
// The global generator checks extensions of enabled languages. // The global generator checks extensions of enabled languages.
cmGlobalGenerator* gg = this->Makefile->GetGlobalGenerator(); cmGlobalGenerator* gg = this->Makefile->GetGlobalGenerator();
cmMakefile const* mf = this->Makefile; cmMakefile const* mf = this->Makefile;
const std::vector<std::string>& srcExts = mf->GetSourceExtensions(); const std::vector<std::string>& srcExts =
const std::vector<std::string>& hdrExts = mf->GetHeaderExtensions(); mf->GetCMakeInstance()->GetSourceExtensions();
const std::vector<std::string>& hdrExts =
mf->GetCMakeInstance()->GetHeaderExtensions();
if(!gg->GetLanguageFromExtension(ext.c_str()).empty() || if(!gg->GetLanguageFromExtension(ext.c_str()).empty() ||
std::find(srcExts.begin(), srcExts.end(), ext) != srcExts.end() || std::find(srcExts.begin(), srcExts.end(), ext) != srcExts.end() ||
std::find(hdrExts.begin(), hdrExts.end(), ext) != hdrExts.end()) std::find(hdrExts.begin(), hdrExts.end(), ext) != hdrExts.end())
@ -193,12 +195,14 @@ cmSourceFileLocation
// disk. One of these must match if loc refers to this source file. // disk. One of these must match if loc refers to this source file.
std::string const& ext = this->Name.substr(loc.Name.size()+1); std::string const& ext = this->Name.substr(loc.Name.size()+1);
cmMakefile const* mf = this->Makefile; cmMakefile const* mf = this->Makefile;
const std::vector<std::string>& srcExts = mf->GetSourceExtensions(); const std::vector<std::string>& srcExts =
mf->GetCMakeInstance()->GetSourceExtensions();
if(std::find(srcExts.begin(), srcExts.end(), ext) != srcExts.end()) if(std::find(srcExts.begin(), srcExts.end(), ext) != srcExts.end())
{ {
return true; return true;
} }
const std::vector<std::string>& hdrExts = mf->GetHeaderExtensions(); std::vector<std::string> hdrExts =
mf->GetCMakeInstance()->GetHeaderExtensions();
if(std::find(hdrExts.begin(), hdrExts.end(), ext) != hdrExts.end()) if(std::find(hdrExts.begin(), hdrExts.end(), ext) != hdrExts.end())
{ {
return true; return true;

View File

@ -63,6 +63,7 @@ cmTarget::cmTarget()
this->IsAndroid = false; this->IsAndroid = false;
this->IsApple = false; this->IsApple = false;
this->IsImportedTarget = false; this->IsImportedTarget = false;
this->ImportedGloballyVisible = false;
this->BuildInterfaceIncludesAppended = false; this->BuildInterfaceIncludesAppended = false;
} }
@ -314,23 +315,6 @@ cmListFileBacktrace const* cmTarget::GetUtilityBacktrace(
return &i->second; return &i->second;
} }
//----------------------------------------------------------------------------
void cmTarget::FinishConfigure()
{
// Erase any cached link information that might have been comptued
// on-demand during the configuration. This ensures that build
// system generation uses up-to-date information even if other cache
// invalidation code in this source file is buggy.
#if defined(_WIN32) && !defined(__CYGWIN__)
// Do old-style link dependency analysis only for CM_USE_OLD_VS6.
if(this->Makefile->GetGlobalGenerator()->IsForVS6())
{
this->AnalyzeLibDependenciesForVS6(*this->Makefile);
}
#endif
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
cmListFileBacktrace const& cmTarget::GetBacktrace() const cmListFileBacktrace const& cmTarget::GetBacktrace() const
{ {
@ -1522,9 +1506,10 @@ void cmTarget::CheckProperty(const std::string& prop,
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void cmTarget::MarkAsImported() void cmTarget::MarkAsImported(bool global)
{ {
this->IsImportedTarget = true; this->IsImportedTarget = true;
this->ImportedGloballyVisible = global;
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
@ -1617,7 +1602,7 @@ const char *cmTarget::GetProperty(const std::string& prop,
// CMake time. // CMake time.
cmGlobalGenerator* gg = this->Makefile->GetGlobalGenerator(); cmGlobalGenerator* gg = this->Makefile->GetGlobalGenerator();
gg->CreateGenerationObjects(); gg->CreateGenerationObjects();
cmGeneratorTarget* gt = gg->GetGeneratorTarget(this); cmGeneratorTarget* gt = gg->FindGeneratorTarget(this->GetName());
this->Properties.SetProperty(propLOCATION, this->Properties.SetProperty(propLOCATION,
gt->GetLocationForBuild()); gt->GetLocationForBuild());
} }
@ -1642,7 +1627,7 @@ const char *cmTarget::GetProperty(const std::string& prop,
{ {
cmGlobalGenerator* gg = this->Makefile->GetGlobalGenerator(); cmGlobalGenerator* gg = this->Makefile->GetGlobalGenerator();
gg->CreateGenerationObjects(); gg->CreateGenerationObjects();
cmGeneratorTarget* gt = gg->GetGeneratorTarget(this); cmGeneratorTarget* gt = gg->FindGeneratorTarget(this->GetName());
this->Properties.SetProperty( this->Properties.SetProperty(
prop, gt->GetFullPath(configName, false).c_str()); prop, gt->GetFullPath(configName, false).c_str());
} }
@ -1666,7 +1651,7 @@ const char *cmTarget::GetProperty(const std::string& prop,
{ {
cmGlobalGenerator* gg = this->Makefile->GetGlobalGenerator(); cmGlobalGenerator* gg = this->Makefile->GetGlobalGenerator();
gg->CreateGenerationObjects(); gg->CreateGenerationObjects();
cmGeneratorTarget* gt = gg->GetGeneratorTarget(this); cmGeneratorTarget* gt = gg->FindGeneratorTarget(this->GetName());
this->Properties.SetProperty( this->Properties.SetProperty(
prop, gt->GetFullPath(configName, false).c_str()); prop, gt->GetFullPath(configName, false).c_str());
} }
@ -2048,25 +2033,6 @@ void cmTarget::SetPropertyDefault(const std::string& property,
} }
} }
//----------------------------------------------------------------------------
std::string cmTarget::GetFrameworkVersion() const
{
assert(this->GetType() != cmState::INTERFACE_LIBRARY);
if(const char* fversion = this->GetProperty("FRAMEWORK_VERSION"))
{
return fversion;
}
else if(const char* tversion = this->GetProperty("VERSION"))
{
return tversion;
}
else
{
return "A";
}
}
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,

View File

@ -75,7 +75,7 @@ public:
*/ */
void SetType(cmState::TargetType f, const std::string& name); void SetType(cmState::TargetType f, const std::string& name);
void MarkAsImported(); void MarkAsImported(bool global = false);
///! 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;}
@ -176,9 +176,6 @@ public:
std::set<std::string>const& GetUtilities() const { return this->Utilities; } std::set<std::string>const& GetUtilities() const { return this->Utilities; }
cmListFileBacktrace const* GetUtilityBacktrace(const std::string& u) const; cmListFileBacktrace const* GetUtilityBacktrace(const std::string& u) const;
/** Finalize the target at the end of the Configure step. */
void FinishConfigure();
///! Set/Get a property of this target file ///! Set/Get a property of this target file
void SetProperty(const std::string& prop, const char *value); void SetProperty(const std::string& prop, const char *value);
void AppendProperty(const std::string& prop, const char* value, void AppendProperty(const std::string& prop, const char* value,
@ -189,6 +186,8 @@ public:
void CheckProperty(const std::string& prop, cmMakefile* context) const; void CheckProperty(const std::string& prop, cmMakefile* context) const;
bool IsImported() const {return this->IsImportedTarget;} bool IsImported() const {return this->IsImportedTarget;}
bool IsImportedGloballyVisible() const
{ return this->ImportedGloballyVisible; }
// Get the properties // Get the properties
cmPropertyMap &GetProperties() const { return this->Properties; } cmPropertyMap &GetProperties() const { return this->Properties; }
@ -209,10 +208,6 @@ public:
/** 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;
/** Return the framework version string. Undefined if
IsFrameworkOnApple returns false. */
std::string GetFrameworkVersion() const;
/** Get a backtrace from the creation of the target. */ /** Get a backtrace from the creation of the target. */
cmListFileBacktrace const& GetBacktrace() const; cmListFileBacktrace const& GetBacktrace() const;
@ -234,9 +229,6 @@ public:
std::set<std::string> const & GetSystemIncludeDirectories() const std::set<std::string> const & GetSystemIncludeDirectories() const
{ return this->SystemIncludeDirectories; } { return this->SystemIncludeDirectories; }
bool LinkLanguagePropagatesToDependents() const
{ return this->TargetTypeValue == cmState::STATIC_LIBRARY; }
cmStringRange GetIncludeDirectoriesEntries() const; cmStringRange GetIncludeDirectoriesEntries() const;
cmBacktraceRange GetIncludeDirectoriesBacktraces() const; cmBacktraceRange GetIncludeDirectoriesBacktraces() const;
@ -254,10 +246,11 @@ public:
cmStringRange GetLinkImplementationEntries() const; cmStringRange GetLinkImplementationEntries() const;
cmBacktraceRange GetLinkImplementationBacktraces() const; cmBacktraceRange GetLinkImplementationBacktraces() const;
#if defined(_WIN32) && !defined(__CYGWIN__) #if defined(_WIN32) && !defined(__CYGWIN__)
const LinkLibraryVectorType &GetLinkLibrariesForVS6() const { const LinkLibraryVectorType &GetLinkLibrariesForVS6() const {
return this->LinkLibrariesForVS6;} return this->LinkLibrariesForVS6;}
void AnalyzeLibDependenciesForVS6( const cmMakefile& mf );
#endif #endif
struct StrictTargetComparison { struct StrictTargetComparison {
@ -316,8 +309,6 @@ private:
void GatherDependenciesForVS6( const cmMakefile& mf, void GatherDependenciesForVS6( const cmMakefile& mf,
const LibraryID& lib, const LibraryID& lib,
DependencyMap& dep_map); DependencyMap& dep_map);
void AnalyzeLibDependenciesForVS6( const cmMakefile& mf );
#endif #endif
const char* GetSuffixVariableInternal(bool implib) const; const char* GetSuffixVariableInternal(bool implib) const;
@ -360,6 +351,7 @@ private:
bool IsAndroid; bool IsAndroid;
bool IsApple; bool IsApple;
bool IsImportedTarget; bool IsImportedTarget;
bool ImportedGloballyVisible;
bool BuildInterfaceIncludesAppended; bool BuildInterfaceIncludesAppended;
#if defined(_WIN32) && !defined(__CYGWIN__) #if defined(_WIN32) && !defined(__CYGWIN__)
bool LinkLibrariesForVS6Analyzed; bool LinkLibrariesForVS6Analyzed;

View File

@ -2814,7 +2814,7 @@ cmVisualStudio10TargetGenerator::WriteEvents(std::string const& configName)
{ {
addedPrelink = true; addedPrelink = true;
std::vector<cmCustomCommand> commands = std::vector<cmCustomCommand> commands =
this->GeneratorTarget->Target->GetPreLinkCommands(); this->GeneratorTarget->GetPreLinkCommands();
this->GlobalGenerator->AddSymbolExportCommand( this->GlobalGenerator->AddSymbolExportCommand(
this->GeneratorTarget, commands, configName); this->GeneratorTarget, commands, configName);
this->WriteEvent("PreLinkEvent", commands, configName); this->WriteEvent("PreLinkEvent", commands, configName);
@ -2823,12 +2823,12 @@ cmVisualStudio10TargetGenerator::WriteEvents(std::string const& configName)
if (!addedPrelink) if (!addedPrelink)
{ {
this->WriteEvent("PreLinkEvent", this->WriteEvent("PreLinkEvent",
this->GeneratorTarget->Target->GetPreLinkCommands(), configName); this->GeneratorTarget->GetPreLinkCommands(), configName);
} }
this->WriteEvent("PreBuildEvent", this->WriteEvent("PreBuildEvent",
this->GeneratorTarget->Target->GetPreBuildCommands(), configName); this->GeneratorTarget->GetPreBuildCommands(), configName);
this->WriteEvent("PostBuildEvent", this->WriteEvent("PostBuildEvent",
this->GeneratorTarget->Target->GetPostBuildCommands(), configName); this->GeneratorTarget->GetPostBuildCommands(), configName);
} }
void cmVisualStudio10TargetGenerator::WriteEvent( void cmVisualStudio10TargetGenerator::WriteEvent(

View File

@ -165,6 +165,30 @@ cmake::cmake()
// Make sure we can capture the build tool output. // Make sure we can capture the build tool output.
cmSystemTools::EnableVSConsoleOutput(); cmSystemTools::EnableVSConsoleOutput();
// Set up a list of source and header extensions
// these are used to find files when the extension
// is not given
// The "c" extension MUST precede the "C" extension.
this->SourceFileExtensions.push_back( "c" );
this->SourceFileExtensions.push_back( "C" );
this->SourceFileExtensions.push_back( "c++" );
this->SourceFileExtensions.push_back( "cc" );
this->SourceFileExtensions.push_back( "cpp" );
this->SourceFileExtensions.push_back( "cxx" );
this->SourceFileExtensions.push_back( "m" );
this->SourceFileExtensions.push_back( "M" );
this->SourceFileExtensions.push_back( "mm" );
this->HeaderFileExtensions.push_back( "h" );
this->HeaderFileExtensions.push_back( "hh" );
this->HeaderFileExtensions.push_back( "h++" );
this->HeaderFileExtensions.push_back( "hm" );
this->HeaderFileExtensions.push_back( "hpp" );
this->HeaderFileExtensions.push_back( "hxx" );
this->HeaderFileExtensions.push_back( "in" );
this->HeaderFileExtensions.push_back( "txx" );
} }
cmake::~cmake() cmake::~cmake()
@ -423,8 +447,8 @@ bool cmake::FindPackage(const std::vector<std::string>& args)
(cmSystemTools::GetCurrentWorkingDirectory()); (cmSystemTools::GetCurrentWorkingDirectory());
// read in the list file to fill the cache // read in the list file to fill the cache
snapshot.SetDefaultDefinitions(); snapshot.SetDefaultDefinitions();
cmsys::auto_ptr<cmMakefile> mf(new cmMakefile(gg, snapshot)); cmMakefile* mf = new cmMakefile(gg, snapshot);
cmsys::auto_ptr<cmLocalGenerator> lg(gg->CreateLocalGenerator(mf.get())); gg->AddMakefile(mf);
mf->SetArgcArgv(args); mf->SetArgcArgv(args);
@ -457,6 +481,8 @@ bool cmake::FindPackage(const std::vector<std::string>& args)
std::vector<std::string> includeDirs; std::vector<std::string> includeDirs;
cmSystemTools::ExpandListArgument(includes, includeDirs); cmSystemTools::ExpandListArgument(includes, includeDirs);
gg->CreateGenerationObjects();
cmLocalGenerator* lg = gg->LocalGenerators[0];
std::string includeFlags = lg->GetIncludeFlags(includeDirs, 0, language); std::string includeFlags = lg->GetIncludeFlags(includeDirs, 0, language);
std::string definitions = mf->GetSafeDefinition("PACKAGE_DEFINITIONS"); std::string definitions = mf->GetSafeDefinition("PACKAGE_DEFINITIONS");
@ -486,8 +512,9 @@ bool cmake::FindPackage(const std::vector<std::string>& args)
std::string linkPath; std::string linkPath;
std::string flags; std::string flags;
std::string linkFlags; std::string linkFlags;
gg->CreateGeneratorTargets(cmGlobalGenerator::AllTargets, lg.get()); gg->CreateGenerationObjects();
cmGeneratorTarget *gtgt = gg->GetGeneratorTarget(tgt); cmGeneratorTarget *gtgt = gg->FindGeneratorTarget(tgt->GetName());
cmLocalGenerator* lg = gtgt->GetLocalGenerator();
lg->GetTargetFlags(linkLibs, frameworkPath, linkPath, flags, linkFlags, lg->GetTargetFlags(linkLibs, frameworkPath, linkPath, flags, linkFlags,
gtgt, false); gtgt, false);
linkLibs = frameworkPath + linkPath + linkLibs; linkLibs = frameworkPath + linkPath + linkLibs;

View File

@ -182,6 +182,11 @@ class cmake
///! get the cmCachemManager used by this invocation of cmake ///! get the cmCachemManager used by this invocation of cmake
cmCacheManager *GetCacheManager() { return this->CacheManager; } cmCacheManager *GetCacheManager() { return this->CacheManager; }
const std::vector<std::string>& GetSourceExtensions() const
{return this->SourceFileExtensions;}
const std::vector<std::string>& GetHeaderExtensions() const
{return this->HeaderFileExtensions;}
/** /**
* Given a variable name, return its value (as a string). * Given a variable name, return its value (as a string).
*/ */
@ -391,6 +396,8 @@ private:
std::string CheckStampFile; std::string CheckStampFile;
std::string CheckStampList; std::string CheckStampList;
std::string VSSolutionFile; std::string VSSolutionFile;
std::vector<std::string> SourceFileExtensions;
std::vector<std::string> HeaderFileExtensions;
bool ClearBuildSystem; bool ClearBuildSystem;
bool DebugTryCompile; bool DebugTryCompile;
cmFileTimeComparison* FileComparison; cmFileTimeComparison* FileComparison;