cmGeneratorTarget: Move compile defintions processing from cmTarget.
This commit is contained in:
parent
d051086cce
commit
a7f5d70dde
|
@ -609,7 +609,7 @@ void cmExtraCodeBlocksGenerator::AppendTarget(cmGeneratedFileStream& fout,
|
||||||
|
|
||||||
// the compilerdefines for this target
|
// the compilerdefines for this target
|
||||||
std::vector<std::string> cdefs;
|
std::vector<std::string> cdefs;
|
||||||
target->GetCompileDefinitions(cdefs, buildType, "C");
|
gtgt->GetCompileDefinitions(cdefs, buildType, "C");
|
||||||
|
|
||||||
// Expand the list.
|
// Expand the list.
|
||||||
for(std::vector<std::string>::const_iterator di = cdefs.begin();
|
for(std::vector<std::string>::const_iterator di = cdefs.begin();
|
||||||
|
|
|
@ -263,7 +263,8 @@ cmGeneratorTarget::cmGeneratorTarget(cmTarget* t, cmLocalGenerator* lg)
|
||||||
PolicyWarnedCMP0022(false),
|
PolicyWarnedCMP0022(false),
|
||||||
DebugIncludesDone(false),
|
DebugIncludesDone(false),
|
||||||
DebugCompileOptionsDone(false),
|
DebugCompileOptionsDone(false),
|
||||||
DebugCompileFeaturesDone(false)
|
DebugCompileFeaturesDone(false),
|
||||||
|
DebugCompileDefinitionsDone(false)
|
||||||
{
|
{
|
||||||
this->Makefile = this->Target->GetMakefile();
|
this->Makefile = this->Target->GetMakefile();
|
||||||
this->LocalGenerator = lg;
|
this->LocalGenerator = lg;
|
||||||
|
@ -283,6 +284,11 @@ cmGeneratorTarget::cmGeneratorTarget(cmTarget* t, cmLocalGenerator* lg)
|
||||||
t->GetCompileFeaturesEntries(),
|
t->GetCompileFeaturesEntries(),
|
||||||
t->GetCompileFeaturesBacktraces(),
|
t->GetCompileFeaturesBacktraces(),
|
||||||
this->CompileFeaturesEntries);
|
this->CompileFeaturesEntries);
|
||||||
|
|
||||||
|
CreatePropertyGeneratorExpressions(
|
||||||
|
t->GetCompileDefinitionsEntries(),
|
||||||
|
t->GetCompileDefinitionsBacktraces(),
|
||||||
|
this->CompileDefinitionsEntries);
|
||||||
}
|
}
|
||||||
|
|
||||||
cmGeneratorTarget::~cmGeneratorTarget()
|
cmGeneratorTarget::~cmGeneratorTarget()
|
||||||
|
@ -290,6 +296,7 @@ cmGeneratorTarget::~cmGeneratorTarget()
|
||||||
cmDeleteAll(this->IncludeDirectoriesEntries);
|
cmDeleteAll(this->IncludeDirectoriesEntries);
|
||||||
cmDeleteAll(this->CompileOptionsEntries);
|
cmDeleteAll(this->CompileOptionsEntries);
|
||||||
cmDeleteAll(this->CompileFeaturesEntries);
|
cmDeleteAll(this->CompileFeaturesEntries);
|
||||||
|
cmDeleteAll(this->CompileDefinitionsEntries);
|
||||||
cmDeleteAll(this->LinkInformation);
|
cmDeleteAll(this->LinkInformation);
|
||||||
this->LinkInformation.clear();
|
this->LinkInformation.clear();
|
||||||
}
|
}
|
||||||
|
@ -2444,6 +2451,108 @@ void cmGeneratorTarget::GetCompileFeatures(std::vector<std::string> &result,
|
||||||
cmDeleteAll(linkInterfaceCompileFeaturesEntries);
|
cmDeleteAll(linkInterfaceCompileFeaturesEntries);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
static void processCompileDefinitions(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,
|
||||||
|
std::string const& language)
|
||||||
|
{
|
||||||
|
processCompileOptionsInternal(tgt, entries, options, uniqueOptions,
|
||||||
|
dagChecker, config, debugOptions,
|
||||||
|
"definitions", language);
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
void cmGeneratorTarget::GetCompileDefinitions(std::vector<std::string> &list,
|
||||||
|
const std::string& config,
|
||||||
|
const std::string& language) const
|
||||||
|
{
|
||||||
|
UNORDERED_SET<std::string> uniqueOptions;
|
||||||
|
|
||||||
|
cmGeneratorExpressionDAGChecker dagChecker(this->GetName(),
|
||||||
|
"COMPILE_DEFINITIONS", 0, 0);
|
||||||
|
|
||||||
|
std::vector<std::string> debugProperties;
|
||||||
|
const char *debugProp =
|
||||||
|
this->Makefile->GetDefinition("CMAKE_DEBUG_TARGET_PROPERTIES");
|
||||||
|
if (debugProp)
|
||||||
|
{
|
||||||
|
cmSystemTools::ExpandListArgument(debugProp, debugProperties);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool debugDefines = !this->DebugCompileDefinitionsDone
|
||||||
|
&& std::find(debugProperties.begin(),
|
||||||
|
debugProperties.end(),
|
||||||
|
"COMPILE_DEFINITIONS")
|
||||||
|
!= debugProperties.end();
|
||||||
|
|
||||||
|
if (this->Makefile->IsConfigured())
|
||||||
|
{
|
||||||
|
this->DebugCompileDefinitionsDone = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
processCompileDefinitions(this,
|
||||||
|
this->CompileDefinitionsEntries,
|
||||||
|
list,
|
||||||
|
uniqueOptions,
|
||||||
|
&dagChecker,
|
||||||
|
config,
|
||||||
|
debugDefines,
|
||||||
|
language);
|
||||||
|
|
||||||
|
std::vector<cmGeneratorTarget::TargetPropertyEntry*>
|
||||||
|
linkInterfaceCompileDefinitionsEntries;
|
||||||
|
AddInterfaceEntries(
|
||||||
|
this, config, "INTERFACE_COMPILE_DEFINITIONS",
|
||||||
|
linkInterfaceCompileDefinitionsEntries);
|
||||||
|
if (!config.empty())
|
||||||
|
{
|
||||||
|
std::string configPropName = "COMPILE_DEFINITIONS_"
|
||||||
|
+ cmSystemTools::UpperCase(config);
|
||||||
|
const char *configProp = this->Target->GetProperty(configPropName);
|
||||||
|
if (configProp)
|
||||||
|
{
|
||||||
|
switch(this->Makefile->GetPolicyStatus(cmPolicies::CMP0043))
|
||||||
|
{
|
||||||
|
case cmPolicies::WARN:
|
||||||
|
{
|
||||||
|
std::ostringstream e;
|
||||||
|
e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0043);
|
||||||
|
this->LocalGenerator->IssueMessage(cmake::AUTHOR_WARNING,
|
||||||
|
e.str());
|
||||||
|
}
|
||||||
|
case cmPolicies::OLD:
|
||||||
|
{
|
||||||
|
cmGeneratorExpression ge;
|
||||||
|
cmsys::auto_ptr<cmCompiledGeneratorExpression> cge =
|
||||||
|
ge.Parse(configProp);
|
||||||
|
linkInterfaceCompileDefinitionsEntries
|
||||||
|
.push_back(new cmGeneratorTarget::TargetPropertyEntry(cge));
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case cmPolicies::NEW:
|
||||||
|
case cmPolicies::REQUIRED_ALWAYS:
|
||||||
|
case cmPolicies::REQUIRED_IF_USED:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
processCompileDefinitions(this,
|
||||||
|
linkInterfaceCompileDefinitionsEntries,
|
||||||
|
list,
|
||||||
|
uniqueOptions,
|
||||||
|
&dagChecker,
|
||||||
|
config,
|
||||||
|
debugDefines,
|
||||||
|
language);
|
||||||
|
|
||||||
|
cmDeleteAll(linkInterfaceCompileDefinitionsEntries);
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
void cmGeneratorTarget::GenerateTargetManifest(
|
void cmGeneratorTarget::GenerateTargetManifest(
|
||||||
const std::string& config) const
|
const std::string& config) const
|
||||||
|
|
|
@ -224,6 +224,10 @@ public:
|
||||||
void GetCompileFeatures(std::vector<std::string> &features,
|
void GetCompileFeatures(std::vector<std::string> &features,
|
||||||
const std::string& config) const;
|
const std::string& config) const;
|
||||||
|
|
||||||
|
void GetCompileDefinitions(std::vector<std::string> &result,
|
||||||
|
const std::string& config,
|
||||||
|
const std::string& language) const;
|
||||||
|
|
||||||
bool IsSystemIncludeDirectory(const std::string& dir,
|
bool IsSystemIncludeDirectory(const std::string& dir,
|
||||||
const std::string& config) const;
|
const std::string& config) const;
|
||||||
|
|
||||||
|
@ -416,6 +420,7 @@ private:
|
||||||
std::vector<TargetPropertyEntry*> IncludeDirectoriesEntries;
|
std::vector<TargetPropertyEntry*> IncludeDirectoriesEntries;
|
||||||
std::vector<TargetPropertyEntry*> CompileOptionsEntries;
|
std::vector<TargetPropertyEntry*> CompileOptionsEntries;
|
||||||
std::vector<TargetPropertyEntry*> CompileFeaturesEntries;
|
std::vector<TargetPropertyEntry*> CompileFeaturesEntries;
|
||||||
|
std::vector<TargetPropertyEntry*> CompileDefinitionsEntries;
|
||||||
|
|
||||||
void ExpandLinkItems(std::string const& prop, std::string const& value,
|
void ExpandLinkItems(std::string const& prop, std::string const& value,
|
||||||
std::string const& config, cmTarget const* headTarget,
|
std::string const& config, cmTarget const* headTarget,
|
||||||
|
@ -432,6 +437,7 @@ private:
|
||||||
mutable bool DebugIncludesDone;
|
mutable bool DebugIncludesDone;
|
||||||
mutable bool DebugCompileOptionsDone;
|
mutable bool DebugCompileOptionsDone;
|
||||||
mutable bool DebugCompileFeaturesDone;
|
mutable bool DebugCompileFeaturesDone;
|
||||||
|
mutable bool DebugCompileDefinitionsDone;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
std::vector<cmTarget const*> const&
|
std::vector<cmTarget const*> const&
|
||||||
|
|
|
@ -330,7 +330,8 @@ void cmGhsMultiTargetGenerator::WriteCompilerDefinitions(
|
||||||
const std::string &config, const std::string &language)
|
const std::string &config, const std::string &language)
|
||||||
{
|
{
|
||||||
std::vector<std::string> compileDefinitions;
|
std::vector<std::string> compileDefinitions;
|
||||||
this->Target->GetCompileDefinitions(compileDefinitions, config, language);
|
this->GeneratorTarget->GetCompileDefinitions(compileDefinitions,
|
||||||
|
config, language);
|
||||||
for (std::vector<std::string>::const_iterator cdI =
|
for (std::vector<std::string>::const_iterator cdI =
|
||||||
compileDefinitions.begin();
|
compileDefinitions.begin();
|
||||||
cdI != compileDefinitions.end(); ++cdI)
|
cdI != compileDefinitions.end(); ++cdI)
|
||||||
|
|
|
@ -1550,7 +1550,6 @@ void cmGlobalGenerator::CreateGeneratorTargets(TargetTypes targetTypes,
|
||||||
ti != targets.end(); ++ti)
|
ti != targets.end(); ++ti)
|
||||||
{
|
{
|
||||||
cmTarget* t = &ti->second;
|
cmTarget* t = &ti->second;
|
||||||
t->Compute();
|
|
||||||
cmGeneratorTarget* gt = new cmGeneratorTarget(t, lg);
|
cmGeneratorTarget* gt = new cmGeneratorTarget(t, lg);
|
||||||
this->GeneratorTargets[t] = gt;
|
this->GeneratorTargets[t] = gt;
|
||||||
generatorTargets[t] = gt;
|
generatorTargets[t] = gt;
|
||||||
|
|
|
@ -254,7 +254,7 @@ bool cmGlobalVisualStudio8Generator::AddCheckTarget()
|
||||||
mf->AddUtilityCommand(CMAKE_CHECK_BUILD_SYSTEM_TARGET, false,
|
mf->AddUtilityCommand(CMAKE_CHECK_BUILD_SYSTEM_TARGET, false,
|
||||||
no_working_directory, no_depends,
|
no_working_directory, no_depends,
|
||||||
noCommandLines);
|
noCommandLines);
|
||||||
tgt->Compute();
|
|
||||||
cmGeneratorTarget* gt = new cmGeneratorTarget(tgt, lg);
|
cmGeneratorTarget* gt = new cmGeneratorTarget(tgt, lg);
|
||||||
mf->AddGeneratorTarget(tgt, gt);
|
mf->AddGeneratorTarget(tgt, gt);
|
||||||
|
|
||||||
|
|
|
@ -90,7 +90,7 @@ bool cmGlobalVisualStudioGenerator::Compute()
|
||||||
AddUtilityCommand("ALL_BUILD", true, no_working_dir,
|
AddUtilityCommand("ALL_BUILD", true, no_working_dir,
|
||||||
no_depends, no_commands, false,
|
no_depends, no_commands, false,
|
||||||
"Build all projects");
|
"Build all projects");
|
||||||
allBuild->Compute();
|
|
||||||
cmGeneratorTarget* gt = new cmGeneratorTarget(allBuild, gen[0]);
|
cmGeneratorTarget* gt = new cmGeneratorTarget(allBuild, gen[0]);
|
||||||
allBuild->GetMakefile()->AddGeneratorTarget(allBuild, gt);
|
allBuild->GetMakefile()->AddGeneratorTarget(allBuild, gt);
|
||||||
|
|
||||||
|
|
|
@ -463,7 +463,7 @@ cmGlobalXCodeGenerator::AddExtraTargets(cmLocalGenerator* root,
|
||||||
cmTarget* allbuild = mf->AddUtilityCommand("ALL_BUILD", true, no_depends,
|
cmTarget* allbuild = mf->AddUtilityCommand("ALL_BUILD", true, no_depends,
|
||||||
no_working_directory,
|
no_working_directory,
|
||||||
"echo", "Build all projects");
|
"echo", "Build all projects");
|
||||||
allbuild->Compute();
|
|
||||||
cmGeneratorTarget* allBuildGt = new cmGeneratorTarget(allbuild, root);
|
cmGeneratorTarget* allBuildGt = new cmGeneratorTarget(allbuild, root);
|
||||||
mf->AddGeneratorTarget(allbuild, allBuildGt);
|
mf->AddGeneratorTarget(allbuild, allBuildGt);
|
||||||
|
|
||||||
|
@ -498,7 +498,7 @@ cmGlobalXCodeGenerator::AddExtraTargets(cmLocalGenerator* root,
|
||||||
true, no_depends,
|
true, no_depends,
|
||||||
no_working_directory,
|
no_working_directory,
|
||||||
"make", "-f", file.c_str());
|
"make", "-f", file.c_str());
|
||||||
check->Compute();
|
|
||||||
cmGeneratorTarget* checkGt = new cmGeneratorTarget(check, root);
|
cmGeneratorTarget* checkGt = new cmGeneratorTarget(check, root);
|
||||||
mf->AddGeneratorTarget(check, checkGt);
|
mf->AddGeneratorTarget(check, checkGt);
|
||||||
}
|
}
|
||||||
|
@ -1855,7 +1855,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
|
||||||
this->AppendDefines(ppDefs, exportMacro);
|
this->AppendDefines(ppDefs, exportMacro);
|
||||||
}
|
}
|
||||||
std::vector<std::string> targetDefines;
|
std::vector<std::string> targetDefines;
|
||||||
target.GetCompileDefinitions(targetDefines, configName, "C");
|
gtgt->GetCompileDefinitions(targetDefines, configName, "C");
|
||||||
this->AppendDefines(ppDefs, targetDefines);
|
this->AppendDefines(ppDefs, targetDefines);
|
||||||
buildSettings->AddAttribute
|
buildSettings->AddAttribute
|
||||||
("GCC_PREPROCESSOR_DEFINITIONS", ppDefs.CreateList());
|
("GCC_PREPROCESSOR_DEFINITIONS", ppDefs.CreateList());
|
||||||
|
|
|
@ -1083,7 +1083,8 @@ void cmLocalGenerator::AddCompileDefinitions(std::set<std::string>& defines,
|
||||||
const std::string& lang)
|
const std::string& lang)
|
||||||
{
|
{
|
||||||
std::vector<std::string> targetDefines;
|
std::vector<std::string> targetDefines;
|
||||||
target->GetCompileDefinitions(targetDefines, config, lang);
|
cmGeneratorTarget* gtgt = this->GlobalGenerator->GetGeneratorTarget(target);
|
||||||
|
gtgt->GetCompileDefinitions(targetDefines, config, lang);
|
||||||
this->AppendDefines(defines, targetDefines);
|
this->AppendDefines(defines, targetDefines);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -763,7 +763,7 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout,
|
||||||
targetOptions.Parse(defineFlags.c_str());
|
targetOptions.Parse(defineFlags.c_str());
|
||||||
targetOptions.ParseFinish();
|
targetOptions.ParseFinish();
|
||||||
std::vector<std::string> targetDefines;
|
std::vector<std::string> targetDefines;
|
||||||
target.GetCompileDefinitions(targetDefines, configName, "CXX");
|
gt->GetCompileDefinitions(targetDefines, configName, "CXX");
|
||||||
targetOptions.AddDefines(targetDefines);
|
targetOptions.AddDefines(targetDefines);
|
||||||
targetOptions.SetVerboseMakefile(
|
targetOptions.SetVerboseMakefile(
|
||||||
this->Makefile->IsOn("CMAKE_VERBOSE_MAKEFILE"));
|
this->Makefile->IsOn("CMAKE_VERBOSE_MAKEFILE"));
|
||||||
|
|
|
@ -474,8 +474,6 @@ bool cmQtAutoGenerators::InitializeAutogenTarget(cmLocalGenerator* lg,
|
||||||
/*byproducts=*/rcc_output, depends,
|
/*byproducts=*/rcc_output, depends,
|
||||||
commandLines, false, autogenComment.c_str());
|
commandLines, false, autogenComment.c_str());
|
||||||
|
|
||||||
autogenTarget->Compute();
|
|
||||||
|
|
||||||
cmGeneratorTarget* gt = new cmGeneratorTarget(autogenTarget, lg);
|
cmGeneratorTarget* gt = new cmGeneratorTarget(autogenTarget, lg);
|
||||||
makefile->AddGeneratorTarget(autogenTarget, gt);
|
makefile->AddGeneratorTarget(autogenTarget, gt);
|
||||||
|
|
||||||
|
|
|
@ -145,7 +145,6 @@ public:
|
||||||
std::vector<cmListFileBacktrace> CompileFeaturesBacktraces;
|
std::vector<cmListFileBacktrace> CompileFeaturesBacktraces;
|
||||||
std::vector<std::string> CompileDefinitionsEntries;
|
std::vector<std::string> CompileDefinitionsEntries;
|
||||||
std::vector<cmListFileBacktrace> CompileDefinitionsBacktraces;
|
std::vector<cmListFileBacktrace> CompileDefinitionsBacktraces;
|
||||||
std::vector<TargetPropertyEntry*> CompileDefinitionsItems;
|
|
||||||
std::vector<TargetPropertyEntry*> SourceEntries;
|
std::vector<TargetPropertyEntry*> SourceEntries;
|
||||||
std::vector<cmValueWithOrigin> LinkImplementationPropertyEntries;
|
std::vector<cmValueWithOrigin> LinkImplementationPropertyEntries;
|
||||||
|
|
||||||
|
@ -174,7 +173,6 @@ cmTarget::cmTarget()
|
||||||
this->IsApple = false;
|
this->IsApple = false;
|
||||||
this->IsImportedTarget = false;
|
this->IsImportedTarget = false;
|
||||||
this->BuildInterfaceIncludesAppended = false;
|
this->BuildInterfaceIncludesAppended = false;
|
||||||
this->DebugCompileDefinitionsDone = false;
|
|
||||||
this->DebugSourcesDone = false;
|
this->DebugSourcesDone = false;
|
||||||
this->LinkImplementationLanguageIsContextDependent = true;
|
this->LinkImplementationLanguageIsContextDependent = true;
|
||||||
}
|
}
|
||||||
|
@ -417,14 +415,6 @@ void CreatePropertyGeneratorExpressions(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void cmTarget::Compute()
|
|
||||||
{
|
|
||||||
CreatePropertyGeneratorExpressions(
|
|
||||||
this->Internal->CompileDefinitionsEntries,
|
|
||||||
this->Internal->CompileDefinitionsBacktraces,
|
|
||||||
this->Internal->CompileDefinitionsItems);
|
|
||||||
}
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
void cmTarget::AddUtility(const std::string& u, cmMakefile *makefile)
|
void cmTarget::AddUtility(const std::string& u, cmMakefile *makefile)
|
||||||
{
|
{
|
||||||
|
@ -1328,6 +1318,16 @@ cmBacktraceRange cmTarget::GetCompileFeaturesBacktraces() const
|
||||||
return cmMakeRange(this->Internal->CompileFeaturesBacktraces);
|
return cmMakeRange(this->Internal->CompileFeaturesBacktraces);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cmStringRange cmTarget::GetCompileDefinitionsEntries() const
|
||||||
|
{
|
||||||
|
return cmMakeRange(this->Internal->CompileDefinitionsEntries);
|
||||||
|
}
|
||||||
|
|
||||||
|
cmBacktraceRange cmTarget::GetCompileDefinitionsBacktraces() const
|
||||||
|
{
|
||||||
|
return cmMakeRange(this->Internal->CompileDefinitionsBacktraces);
|
||||||
|
}
|
||||||
|
|
||||||
#if defined(_WIN32) && !defined(__CYGWIN__)
|
#if defined(_WIN32) && !defined(__CYGWIN__)
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
void
|
void
|
||||||
|
@ -1924,156 +1924,6 @@ void cmTarget::InsertCompileDefinition(std::string const& entry,
|
||||||
this->Internal->CompileDefinitionsBacktraces.push_back(bt);
|
this->Internal->CompileDefinitionsBacktraces.push_back(bt);
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
|
||||||
static void processCompileOptionsInternal(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, const char *logName,
|
|
||||||
std::string const& language)
|
|
||||||
{
|
|
||||||
cmMakefile *mf = tgt->GetMakefile();
|
|
||||||
|
|
||||||
for (std::vector<cmTargetInternals::TargetPropertyEntry*>::const_iterator
|
|
||||||
it = entries.begin(), end = entries.end(); it != end; ++it)
|
|
||||||
{
|
|
||||||
std::vector<std::string> entryOptions;
|
|
||||||
cmSystemTools::ExpandListArgument((*it)->ge->Evaluate(mf,
|
|
||||||
config,
|
|
||||||
false,
|
|
||||||
tgt,
|
|
||||||
dagChecker,
|
|
||||||
language),
|
|
||||||
entryOptions);
|
|
||||||
std::string usedOptions;
|
|
||||||
for(std::vector<std::string>::iterator
|
|
||||||
li = entryOptions.begin(); li != entryOptions.end(); ++li)
|
|
||||||
{
|
|
||||||
std::string const& opt = *li;
|
|
||||||
|
|
||||||
if(uniqueOptions.insert(opt).second)
|
|
||||||
{
|
|
||||||
options.push_back(opt);
|
|
||||||
if (debugOptions)
|
|
||||||
{
|
|
||||||
usedOptions += " * " + opt + "\n";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!usedOptions.empty())
|
|
||||||
{
|
|
||||||
mf->GetCMakeInstance()->IssueMessage(cmake::LOG,
|
|
||||||
std::string("Used compile ") + logName
|
|
||||||
+ std::string(" for target ")
|
|
||||||
+ tgt->GetName() + ":\n"
|
|
||||||
+ usedOptions, (*it)->ge->GetBacktrace());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
|
||||||
static void processCompileDefinitions(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,
|
|
||||||
std::string const& language)
|
|
||||||
{
|
|
||||||
processCompileOptionsInternal(tgt, entries, options, uniqueOptions,
|
|
||||||
dagChecker, config, debugOptions,
|
|
||||||
"definitions", language);
|
|
||||||
}
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
|
||||||
void cmTarget::GetCompileDefinitions(std::vector<std::string> &list,
|
|
||||||
const std::string& config,
|
|
||||||
const std::string& language) const
|
|
||||||
{
|
|
||||||
UNORDERED_SET<std::string> uniqueOptions;
|
|
||||||
|
|
||||||
cmGeneratorExpressionDAGChecker dagChecker(this->GetName(),
|
|
||||||
"COMPILE_DEFINITIONS", 0, 0);
|
|
||||||
|
|
||||||
std::vector<std::string> debugProperties;
|
|
||||||
const char *debugProp =
|
|
||||||
this->Makefile->GetDefinition("CMAKE_DEBUG_TARGET_PROPERTIES");
|
|
||||||
if (debugProp)
|
|
||||||
{
|
|
||||||
cmSystemTools::ExpandListArgument(debugProp, debugProperties);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool debugDefines = !this->DebugCompileDefinitionsDone
|
|
||||||
&& std::find(debugProperties.begin(),
|
|
||||||
debugProperties.end(),
|
|
||||||
"COMPILE_DEFINITIONS")
|
|
||||||
!= debugProperties.end();
|
|
||||||
|
|
||||||
if (this->Makefile->IsConfigured())
|
|
||||||
{
|
|
||||||
this->DebugCompileDefinitionsDone = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
processCompileDefinitions(this,
|
|
||||||
this->Internal->CompileDefinitionsItems,
|
|
||||||
list,
|
|
||||||
uniqueOptions,
|
|
||||||
&dagChecker,
|
|
||||||
config,
|
|
||||||
debugDefines,
|
|
||||||
language);
|
|
||||||
|
|
||||||
std::vector<cmTargetInternals::TargetPropertyEntry*>
|
|
||||||
linkInterfaceCompileDefinitionsEntries;
|
|
||||||
this->Internal->AddInterfaceEntries(
|
|
||||||
this, config, "INTERFACE_COMPILE_DEFINITIONS",
|
|
||||||
linkInterfaceCompileDefinitionsEntries);
|
|
||||||
if (!config.empty())
|
|
||||||
{
|
|
||||||
std::string configPropName = "COMPILE_DEFINITIONS_"
|
|
||||||
+ cmSystemTools::UpperCase(config);
|
|
||||||
const char *configProp = this->GetProperty(configPropName);
|
|
||||||
if (configProp)
|
|
||||||
{
|
|
||||||
switch(this->Makefile->GetPolicyStatus(cmPolicies::CMP0043))
|
|
||||||
{
|
|
||||||
case cmPolicies::WARN:
|
|
||||||
{
|
|
||||||
std::ostringstream e;
|
|
||||||
e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0043);
|
|
||||||
this->Makefile->IssueMessage(cmake::AUTHOR_WARNING,
|
|
||||||
e.str());
|
|
||||||
}
|
|
||||||
case cmPolicies::OLD:
|
|
||||||
{
|
|
||||||
cmGeneratorExpression ge;
|
|
||||||
cmsys::auto_ptr<cmCompiledGeneratorExpression> cge =
|
|
||||||
ge.Parse(configProp);
|
|
||||||
linkInterfaceCompileDefinitionsEntries
|
|
||||||
.push_back(new cmTargetInternals::TargetPropertyEntry(cge));
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case cmPolicies::NEW:
|
|
||||||
case cmPolicies::REQUIRED_ALWAYS:
|
|
||||||
case cmPolicies::REQUIRED_IF_USED:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
processCompileDefinitions(this,
|
|
||||||
linkInterfaceCompileDefinitionsEntries,
|
|
||||||
list,
|
|
||||||
uniqueOptions,
|
|
||||||
&dagChecker,
|
|
||||||
config,
|
|
||||||
debugDefines,
|
|
||||||
language);
|
|
||||||
|
|
||||||
cmDeleteAll(linkInterfaceCompileDefinitionsEntries);
|
|
||||||
}
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
void cmTarget::MaybeInvalidatePropertyCache(const std::string& prop)
|
void cmTarget::MaybeInvalidatePropertyCache(const std::string& prop)
|
||||||
{
|
{
|
||||||
|
@ -4034,7 +3884,6 @@ cmTargetInternalPointer
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
cmTargetInternalPointer::~cmTargetInternalPointer()
|
cmTargetInternalPointer::~cmTargetInternalPointer()
|
||||||
{
|
{
|
||||||
cmDeleteAll(this->Pointer->CompileDefinitionsItems);
|
|
||||||
cmDeleteAll(this->Pointer->SourceEntries);
|
cmDeleteAll(this->Pointer->SourceEntries);
|
||||||
delete this->Pointer;
|
delete this->Pointer;
|
||||||
}
|
}
|
||||||
|
|
|
@ -132,8 +132,6 @@ public:
|
||||||
void AddPostBuildCommand(cmCustomCommand const &cmd)
|
void AddPostBuildCommand(cmCustomCommand const &cmd)
|
||||||
{this->PostBuildCommands.push_back(cmd);}
|
{this->PostBuildCommands.push_back(cmd);}
|
||||||
|
|
||||||
void Compute();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the list of the source files used by this target
|
* Get the list of the source files used by this target
|
||||||
*/
|
*/
|
||||||
|
@ -309,10 +307,6 @@ public:
|
||||||
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;
|
||||||
|
|
||||||
void GetCompileDefinitions(std::vector<std::string> &result,
|
|
||||||
const std::string& config,
|
|
||||||
const std::string& language) const;
|
|
||||||
|
|
||||||
// Compute the set of languages compiled by the target. This is
|
// Compute the set of languages compiled by the target. This is
|
||||||
// computed every time it is called because the languages can change
|
// computed every time it is called because the languages can change
|
||||||
// when source file properties are changed and we do not have enough
|
// when source file properties are changed and we do not have enough
|
||||||
|
@ -402,6 +396,9 @@ public:
|
||||||
cmStringRange GetCompileFeaturesEntries() const;
|
cmStringRange GetCompileFeaturesEntries() const;
|
||||||
cmBacktraceRange GetCompileFeaturesBacktraces() const;
|
cmBacktraceRange GetCompileFeaturesBacktraces() const;
|
||||||
|
|
||||||
|
cmStringRange GetCompileDefinitionsEntries() const;
|
||||||
|
cmBacktraceRange GetCompileDefinitionsBacktraces() 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;}
|
||||||
|
@ -516,7 +513,6 @@ private:
|
||||||
bool IsApple;
|
bool IsApple;
|
||||||
bool IsImportedTarget;
|
bool IsImportedTarget;
|
||||||
bool BuildInterfaceIncludesAppended;
|
bool BuildInterfaceIncludesAppended;
|
||||||
mutable bool DebugCompileDefinitionsDone;
|
|
||||||
mutable bool DebugSourcesDone;
|
mutable bool DebugSourcesDone;
|
||||||
mutable bool LinkImplementationLanguageIsContextDependent;
|
mutable bool LinkImplementationLanguageIsContextDependent;
|
||||||
#if defined(_WIN32) && !defined(__CYGWIN__)
|
#if defined(_WIN32) && !defined(__CYGWIN__)
|
||||||
|
|
|
@ -1934,7 +1934,7 @@ bool cmVisualStudio10TargetGenerator::ComputeClOptions(
|
||||||
clOptions.Parse(flags.c_str());
|
clOptions.Parse(flags.c_str());
|
||||||
clOptions.Parse(defineFlags.c_str());
|
clOptions.Parse(defineFlags.c_str());
|
||||||
std::vector<std::string> targetDefines;
|
std::vector<std::string> targetDefines;
|
||||||
this->Target->GetCompileDefinitions(targetDefines,
|
this->GeneratorTarget->GetCompileDefinitions(targetDefines,
|
||||||
configName.c_str(), "CXX");
|
configName.c_str(), "CXX");
|
||||||
clOptions.AddDefines(targetDefines);
|
clOptions.AddDefines(targetDefines);
|
||||||
if(this->MSTools)
|
if(this->MSTools)
|
||||||
|
|
Loading…
Reference in New Issue