cmGeneratorTarget: Move compile features processing from cmTarget.
This commit is contained in:
parent
db4cb92bda
commit
d051086cce
|
@ -262,7 +262,8 @@ cmGeneratorTarget::cmGeneratorTarget(cmTarget* t, cmLocalGenerator* lg)
|
|||
SourceFileFlagsConstructed(false),
|
||||
PolicyWarnedCMP0022(false),
|
||||
DebugIncludesDone(false),
|
||||
DebugCompileOptionsDone(false)
|
||||
DebugCompileOptionsDone(false),
|
||||
DebugCompileFeaturesDone(false)
|
||||
{
|
||||
this->Makefile = this->Target->GetMakefile();
|
||||
this->LocalGenerator = lg;
|
||||
|
@ -277,12 +278,18 @@ cmGeneratorTarget::cmGeneratorTarget(cmTarget* t, cmLocalGenerator* lg)
|
|||
t->GetCompileOptionsEntries(),
|
||||
t->GetCompileOptionsBacktraces(),
|
||||
this->CompileOptionsEntries);
|
||||
|
||||
CreatePropertyGeneratorExpressions(
|
||||
t->GetCompileFeaturesEntries(),
|
||||
t->GetCompileFeaturesBacktraces(),
|
||||
this->CompileFeaturesEntries);
|
||||
}
|
||||
|
||||
cmGeneratorTarget::~cmGeneratorTarget()
|
||||
{
|
||||
cmDeleteAll(this->IncludeDirectoriesEntries);
|
||||
cmDeleteAll(this->CompileOptionsEntries);
|
||||
cmDeleteAll(this->CompileFeaturesEntries);
|
||||
cmDeleteAll(this->LinkInformation);
|
||||
this->LinkInformation.clear();
|
||||
}
|
||||
|
@ -2370,6 +2377,73 @@ void cmGeneratorTarget::GetCompileOptions(std::vector<std::string> &result,
|
|||
cmDeleteAll(linkInterfaceCompileOptionsEntries);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
static void processCompileFeatures(cmGeneratorTarget const* tgt,
|
||||
const std::vector<cmGeneratorTarget::TargetPropertyEntry*> &entries,
|
||||
std::vector<std::string> &options,
|
||||
UNORDERED_SET<std::string> &uniqueOptions,
|
||||
cmGeneratorExpressionDAGChecker *dagChecker,
|
||||
const std::string& config, bool debugOptions)
|
||||
{
|
||||
processCompileOptionsInternal(tgt, entries, options, uniqueOptions,
|
||||
dagChecker, config, debugOptions, "features",
|
||||
std::string());
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
void cmGeneratorTarget::GetCompileFeatures(std::vector<std::string> &result,
|
||||
const std::string& config) const
|
||||
{
|
||||
UNORDERED_SET<std::string> uniqueFeatures;
|
||||
|
||||
cmGeneratorExpressionDAGChecker dagChecker(this->GetName(),
|
||||
"COMPILE_FEATURES",
|
||||
0, 0);
|
||||
|
||||
std::vector<std::string> debugProperties;
|
||||
const char *debugProp =
|
||||
this->Makefile->GetDefinition("CMAKE_DEBUG_TARGET_PROPERTIES");
|
||||
if (debugProp)
|
||||
{
|
||||
cmSystemTools::ExpandListArgument(debugProp, debugProperties);
|
||||
}
|
||||
|
||||
bool debugFeatures = !this->DebugCompileFeaturesDone
|
||||
&& std::find(debugProperties.begin(),
|
||||
debugProperties.end(),
|
||||
"COMPILE_FEATURES")
|
||||
!= debugProperties.end();
|
||||
|
||||
if (this->Makefile->IsConfigured())
|
||||
{
|
||||
this->DebugCompileFeaturesDone = true;
|
||||
}
|
||||
|
||||
processCompileFeatures(this,
|
||||
this->CompileFeaturesEntries,
|
||||
result,
|
||||
uniqueFeatures,
|
||||
&dagChecker,
|
||||
config,
|
||||
debugFeatures);
|
||||
|
||||
std::vector<cmGeneratorTarget::TargetPropertyEntry*>
|
||||
linkInterfaceCompileFeaturesEntries;
|
||||
AddInterfaceEntries(
|
||||
this, config, "INTERFACE_COMPILE_FEATURES",
|
||||
linkInterfaceCompileFeaturesEntries);
|
||||
|
||||
processCompileFeatures(this,
|
||||
linkInterfaceCompileFeaturesEntries,
|
||||
result,
|
||||
uniqueFeatures,
|
||||
&dagChecker,
|
||||
config,
|
||||
debugFeatures);
|
||||
|
||||
cmDeleteAll(linkInterfaceCompileFeaturesEntries);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
void cmGeneratorTarget::GenerateTargetManifest(
|
||||
const std::string& config) const
|
||||
|
|
|
@ -221,6 +221,9 @@ public:
|
|||
const std::string& config,
|
||||
const std::string& language) const;
|
||||
|
||||
void GetCompileFeatures(std::vector<std::string> &features,
|
||||
const std::string& config) const;
|
||||
|
||||
bool IsSystemIncludeDirectory(const std::string& dir,
|
||||
const std::string& config) const;
|
||||
|
||||
|
@ -412,6 +415,7 @@ private:
|
|||
|
||||
std::vector<TargetPropertyEntry*> IncludeDirectoriesEntries;
|
||||
std::vector<TargetPropertyEntry*> CompileOptionsEntries;
|
||||
std::vector<TargetPropertyEntry*> CompileFeaturesEntries;
|
||||
|
||||
void ExpandLinkItems(std::string const& prop, std::string const& value,
|
||||
std::string const& config, cmTarget const* headTarget,
|
||||
|
@ -427,6 +431,7 @@ private:
|
|||
mutable bool PolicyWarnedCMP0022;
|
||||
mutable bool DebugIncludesDone;
|
||||
mutable bool DebugCompileOptionsDone;
|
||||
mutable bool DebugCompileFeaturesDone;
|
||||
|
||||
public:
|
||||
std::vector<cmTarget const*> const&
|
||||
|
|
|
@ -1138,7 +1138,7 @@ void cmLocalGenerator::AddCompileOptions(
|
|||
}
|
||||
}
|
||||
std::vector<std::string> features;
|
||||
target->GetCompileFeatures(features, config);
|
||||
gtgt->GetCompileFeatures(features, config);
|
||||
for(std::vector<std::string>::const_iterator it = features.begin();
|
||||
it != features.end(); ++it)
|
||||
{
|
||||
|
|
|
@ -143,7 +143,6 @@ public:
|
|||
std::vector<cmListFileBacktrace> CompileOptionsBacktraces;
|
||||
std::vector<std::string> CompileFeaturesEntries;
|
||||
std::vector<cmListFileBacktrace> CompileFeaturesBacktraces;
|
||||
std::vector<TargetPropertyEntry*> CompileFeaturesItems;
|
||||
std::vector<std::string> CompileDefinitionsEntries;
|
||||
std::vector<cmListFileBacktrace> CompileDefinitionsBacktraces;
|
||||
std::vector<TargetPropertyEntry*> CompileDefinitionsItems;
|
||||
|
@ -175,7 +174,6 @@ cmTarget::cmTarget()
|
|||
this->IsApple = false;
|
||||
this->IsImportedTarget = false;
|
||||
this->BuildInterfaceIncludesAppended = false;
|
||||
this->DebugCompileFeaturesDone = false;
|
||||
this->DebugCompileDefinitionsDone = false;
|
||||
this->DebugSourcesDone = false;
|
||||
this->LinkImplementationLanguageIsContextDependent = true;
|
||||
|
@ -421,11 +419,6 @@ void CreatePropertyGeneratorExpressions(
|
|||
|
||||
void cmTarget::Compute()
|
||||
{
|
||||
CreatePropertyGeneratorExpressions(
|
||||
this->Internal->CompileFeaturesEntries,
|
||||
this->Internal->CompileFeaturesBacktraces,
|
||||
this->Internal->CompileFeaturesItems);
|
||||
|
||||
CreatePropertyGeneratorExpressions(
|
||||
this->Internal->CompileDefinitionsEntries,
|
||||
this->Internal->CompileDefinitionsBacktraces,
|
||||
|
@ -1325,6 +1318,16 @@ cmBacktraceRange cmTarget::GetCompileOptionsBacktraces() const
|
|||
return cmMakeRange(this->Internal->CompileOptionsBacktraces);
|
||||
}
|
||||
|
||||
cmStringRange cmTarget::GetCompileFeaturesEntries() const
|
||||
{
|
||||
return cmMakeRange(this->Internal->CompileFeaturesEntries);
|
||||
}
|
||||
|
||||
cmBacktraceRange cmTarget::GetCompileFeaturesBacktraces() const
|
||||
{
|
||||
return cmMakeRange(this->Internal->CompileFeaturesBacktraces);
|
||||
}
|
||||
|
||||
#if defined(_WIN32) && !defined(__CYGWIN__)
|
||||
//----------------------------------------------------------------------------
|
||||
void
|
||||
|
@ -2071,73 +2074,6 @@ void cmTarget::GetCompileDefinitions(std::vector<std::string> &list,
|
|||
cmDeleteAll(linkInterfaceCompileDefinitionsEntries);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
static void processCompileFeatures(cmTarget const* tgt,
|
||||
const std::vector<cmTargetInternals::TargetPropertyEntry*> &entries,
|
||||
std::vector<std::string> &options,
|
||||
UNORDERED_SET<std::string> &uniqueOptions,
|
||||
cmGeneratorExpressionDAGChecker *dagChecker,
|
||||
const std::string& config, bool debugOptions)
|
||||
{
|
||||
processCompileOptionsInternal(tgt, entries, options, uniqueOptions,
|
||||
dagChecker, config, debugOptions, "features",
|
||||
std::string());
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
void cmTarget::GetCompileFeatures(std::vector<std::string> &result,
|
||||
const std::string& config) const
|
||||
{
|
||||
UNORDERED_SET<std::string> uniqueFeatures;
|
||||
|
||||
cmGeneratorExpressionDAGChecker dagChecker(this->GetName(),
|
||||
"COMPILE_FEATURES",
|
||||
0, 0);
|
||||
|
||||
std::vector<std::string> debugProperties;
|
||||
const char *debugProp =
|
||||
this->Makefile->GetDefinition("CMAKE_DEBUG_TARGET_PROPERTIES");
|
||||
if (debugProp)
|
||||
{
|
||||
cmSystemTools::ExpandListArgument(debugProp, debugProperties);
|
||||
}
|
||||
|
||||
bool debugFeatures = !this->DebugCompileFeaturesDone
|
||||
&& std::find(debugProperties.begin(),
|
||||
debugProperties.end(),
|
||||
"COMPILE_FEATURES")
|
||||
!= debugProperties.end();
|
||||
|
||||
if (this->Makefile->IsConfigured())
|
||||
{
|
||||
this->DebugCompileFeaturesDone = true;
|
||||
}
|
||||
|
||||
processCompileFeatures(this,
|
||||
this->Internal->CompileFeaturesItems,
|
||||
result,
|
||||
uniqueFeatures,
|
||||
&dagChecker,
|
||||
config,
|
||||
debugFeatures);
|
||||
|
||||
std::vector<cmTargetInternals::TargetPropertyEntry*>
|
||||
linkInterfaceCompileFeaturesEntries;
|
||||
this->Internal->AddInterfaceEntries(
|
||||
this, config, "INTERFACE_COMPILE_FEATURES",
|
||||
linkInterfaceCompileFeaturesEntries);
|
||||
|
||||
processCompileFeatures(this,
|
||||
linkInterfaceCompileFeaturesEntries,
|
||||
result,
|
||||
uniqueFeatures,
|
||||
&dagChecker,
|
||||
config,
|
||||
debugFeatures);
|
||||
|
||||
cmDeleteAll(linkInterfaceCompileFeaturesEntries);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
void cmTarget::MaybeInvalidatePropertyCache(const std::string& prop)
|
||||
{
|
||||
|
@ -4098,7 +4034,6 @@ cmTargetInternalPointer
|
|||
//----------------------------------------------------------------------------
|
||||
cmTargetInternalPointer::~cmTargetInternalPointer()
|
||||
{
|
||||
cmDeleteAll(this->Pointer->CompileFeaturesItems);
|
||||
cmDeleteAll(this->Pointer->CompileDefinitionsItems);
|
||||
cmDeleteAll(this->Pointer->SourceEntries);
|
||||
delete this->Pointer;
|
||||
|
|
|
@ -375,9 +375,6 @@ public:
|
|||
|
||||
void AppendBuildInterfaceIncludes();
|
||||
|
||||
void GetCompileFeatures(std::vector<std::string> &features,
|
||||
const std::string& config) const;
|
||||
|
||||
bool IsNullImpliedByLinkLibraries(const std::string &p) const;
|
||||
|
||||
std::string GetDebugGeneratorExpressions(const std::string &value,
|
||||
|
@ -402,6 +399,9 @@ public:
|
|||
cmStringRange GetCompileOptionsEntries() const;
|
||||
cmBacktraceRange GetCompileOptionsBacktraces() const;
|
||||
|
||||
cmStringRange GetCompileFeaturesEntries() const;
|
||||
cmBacktraceRange GetCompileFeaturesBacktraces() const;
|
||||
|
||||
#if defined(_WIN32) && !defined(__CYGWIN__)
|
||||
const LinkLibraryVectorType &GetLinkLibrariesForVS6() const {
|
||||
return this->LinkLibrariesForVS6;}
|
||||
|
@ -518,7 +518,6 @@ private:
|
|||
bool BuildInterfaceIncludesAppended;
|
||||
mutable bool DebugCompileDefinitionsDone;
|
||||
mutable bool DebugSourcesDone;
|
||||
mutable bool DebugCompileFeaturesDone;
|
||||
mutable bool LinkImplementationLanguageIsContextDependent;
|
||||
#if defined(_WIN32) && !defined(__CYGWIN__)
|
||||
bool LinkLibrariesForVS6Analyzed;
|
||||
|
|
Loading…
Reference in New Issue