Commit e6971df6 authored by Stephen Kelly's avatar Stephen Kelly

cmTarget: Make the source files depend on the config.

Disallow the use of config-specific source files with
the Visual Studio and Xcode generators. They don't have
any way to represent the condition currently.

Use the same common-config API in cmQtAutoGenerators. While
it accepts config-specific files, it doesn't have to support
multiple configurations yet.

Loop over the configs in cmTargetTraceDependencies
and cmGlobalGenerator::WriteSummary and consume all source
files.

Loop over the configs in cmComputeTargetDepends and compute the
object library dependencies for each config.
parent df753df9
......@@ -213,34 +213,10 @@ void cmComputeTargetDepends::CollectTargetDepends(int depender_index)
// deal with config-specific dependencies.
{
std::set<std::string> emitted;
{
cmGeneratorTarget* gt = depender->GetMakefile()->GetLocalGenerator()
->GetGlobalGenerator()
->GetGeneratorTarget(depender);
std::vector<cmSourceFile const*> objectFiles;
gt->GetExternalObjects(objectFiles);
for(std::vector<cmSourceFile const*>::const_iterator
it = objectFiles.begin(); it != objectFiles.end(); ++it)
{
std::string objLib = (*it)->GetObjectLibrary();
if (!objLib.empty() && emitted.insert(objLib).second)
{
if(depender->GetType() != cmTarget::EXECUTABLE &&
depender->GetType() != cmTarget::STATIC_LIBRARY &&
depender->GetType() != cmTarget::SHARED_LIBRARY &&
depender->GetType() != cmTarget::MODULE_LIBRARY)
{
this->GlobalGenerator->GetCMakeInstance()
->IssueMessage(cmake::FATAL_ERROR,
"Only executables and non-OBJECT libraries may "
"reference target objects.",
depender->GetBacktrace());
return;
}
const_cast<cmTarget*>(depender)->AddUtility(objLib);
}
}
}
std::vector<std::string> configs;
depender->GetMakefile()->GetConfigurations(configs);
if (configs.empty())
......@@ -250,6 +226,29 @@ void cmComputeTargetDepends::CollectTargetDepends(int depender_index)
for (std::vector<std::string>::const_iterator it = configs.begin();
it != configs.end(); ++it)
{
std::vector<cmSourceFile const*> objectFiles;
gt->GetExternalObjects(objectFiles, *it);
for(std::vector<cmSourceFile const*>::const_iterator
oi = objectFiles.begin(); oi != objectFiles.end(); ++oi)
{
std::string objLib = (*oi)->GetObjectLibrary();
if (!objLib.empty() && emitted.insert(objLib).second)
{
if(depender->GetType() != cmTarget::EXECUTABLE &&
depender->GetType() != cmTarget::STATIC_LIBRARY &&
depender->GetType() != cmTarget::SHARED_LIBRARY &&
depender->GetType() != cmTarget::MODULE_LIBRARY)
{
this->GlobalGenerator->GetCMakeInstance()
->IssueMessage(cmake::FATAL_ERROR,
"Only executables and non-OBJECT libraries may "
"reference target objects.",
depender->GetBacktrace());
return;
}
const_cast<cmTarget*>(depender)->AddUtility(objLib);
}
}
std::vector<std::string> tlibs;
depender->GetDirectLinkLibraries(*it, tlibs, depender);
......
......@@ -399,7 +399,8 @@ void cmExtraCodeBlocksGenerator
case cmTarget::UTILITY: // can have sources since 2.6.3
{
std::vector<cmSourceFile*> sources;
ti->second.GetSourceFiles(sources);
ti->second.GetSourceFiles(sources,
makefile->GetSafeDefinition("CMAKE_BUILD_TYPE"));
for (std::vector<cmSourceFile*>::const_iterator si=sources.begin();
si!=sources.end(); si++)
{
......
......@@ -214,7 +214,8 @@ void cmExtraCodeLiteGenerator
case cmTarget::MODULE_LIBRARY:
{
std::vector<cmSourceFile*> sources;
ti->second.GetSourceFiles(sources);
ti->second.GetSourceFiles(sources,
makefile->GetSafeDefinition("CMAKE_BUILD_TYPE"));
for (std::vector<cmSourceFile*>::const_iterator si=sources.begin();
si!=sources.end(); si++)
{
......
......@@ -560,7 +560,8 @@ void cmExtraEclipseCDT4Generator::CreateLinksForTargets(
// get the files from the source lists then add them to the groups
cmTarget* tgt = const_cast<cmTarget*>(&ti->second);
std::vector<cmSourceFile*> files;
tgt->GetSourceFiles(files);
tgt->GetSourceFiles(files,
makefile->GetSafeDefinition("CMAKE_BUILD_TYPE"));
for(std::vector<cmSourceFile*>::const_iterator sfIt = files.begin();
sfIt != files.end();
sfIt++)
......
......@@ -238,7 +238,8 @@ void cmExtraSublimeTextGenerator::
cmGeneratorTarget *gtgt = this->GlobalGenerator
->GetGeneratorTarget(target);
std::vector<cmSourceFile*> sourceFiles;
target->GetSourceFiles(sourceFiles);
target->GetSourceFiles(sourceFiles,
makefile->GetSafeDefinition("CMAKE_BUILD_TYPE"));
std::vector<cmSourceFile*>::const_iterator sourceFilesEnd =
sourceFiles.end();
for (std::vector<cmSourceFile*>::const_iterator iter =
......
......@@ -133,7 +133,7 @@ void cmFLTKWrapUICommand::FinalPass()
return;
}
std::vector<cmSourceFile*> srcs;
target->GetSourceFiles(srcs);
target->GetSourceFiles(srcs, "");
bool found = false;
for (unsigned int i = 0; i < srcs.size(); ++i)
{
......
......@@ -1272,7 +1272,7 @@ static const struct TargetObjectsNode : public cmGeneratorExpressionNode
}
std::vector<cmSourceFile const*> objectSources;
gt->GetObjectSources(objectSources);
gt->GetObjectSources(objectSources, context->Config);
std::map<cmSourceFile const*, std::string> mapping;
for(std::vector<cmSourceFile const*>::const_iterator it
......
......@@ -289,7 +289,7 @@ static void handleSystemIncludesDep(cmMakefile *mf, cmTarget* depTgt,
#define IMPLEMENT_VISIT_IMPL(DATA, DATATYPE) \
{ \
std::vector<cmSourceFile*> sourceFiles; \
this->Target->GetSourceFiles(sourceFiles); \
this->Target->GetSourceFiles(sourceFiles, config); \
TagVisitor<DATA ## Tag DATATYPE> visitor(this->Target, data); \
for(std::vector<cmSourceFile*>::const_iterator si = sourceFiles.begin(); \
si != sourceFiles.end(); ++si) \
......@@ -308,7 +308,8 @@ static void handleSystemIncludesDep(cmMakefile *mf, cmTarget* depTgt,
//----------------------------------------------------------------------------
void
cmGeneratorTarget
::GetObjectSources(std::vector<cmSourceFile const*> &data) const
::GetObjectSources(std::vector<cmSourceFile const*> &data,
const std::string& config) const
{
IMPLEMENT_VISIT(ObjectSources);
......@@ -332,8 +333,19 @@ void cmGeneratorTarget::ComputeObjectMapping()
{
return;
}
std::vector<cmSourceFile const*> sourceFiles;
this->GetObjectSources(sourceFiles);
std::vector<std::string> configs;
this->Makefile->GetConfigurations(configs);
if (configs.empty())
{
configs.push_back("");
}
for(std::vector<std::string>::const_iterator ci = configs.begin();
ci != configs.end(); ++ci)
{
std::vector<cmSourceFile const*> sourceFiles;
this->GetObjectSources(sourceFiles, *ci);
}
}
//----------------------------------------------------------------------------
......@@ -360,7 +372,8 @@ bool cmGeneratorTarget::HasExplicitObjectName(cmSourceFile const* file) const
//----------------------------------------------------------------------------
void cmGeneratorTarget
::GetIDLSources(std::vector<cmSourceFile const*>& data) const
::GetIDLSources(std::vector<cmSourceFile const*>& data,
const std::string& config) const
{
IMPLEMENT_VISIT(IDLSources);
}
......@@ -368,14 +381,16 @@ void cmGeneratorTarget
//----------------------------------------------------------------------------
void
cmGeneratorTarget
::GetHeaderSources(std::vector<cmSourceFile const*>& data) const
::GetHeaderSources(std::vector<cmSourceFile const*>& data,
const std::string& config) const
{
IMPLEMENT_VISIT(HeaderSources);
}
//----------------------------------------------------------------------------
void cmGeneratorTarget
::GetExtraSources(std::vector<cmSourceFile const*>& data) const
::GetExtraSources(std::vector<cmSourceFile const*>& data,
const std::string& config) const
{
IMPLEMENT_VISIT(ExtraSources);
}
......@@ -383,7 +398,8 @@ void cmGeneratorTarget
//----------------------------------------------------------------------------
void
cmGeneratorTarget
::GetCustomCommands(std::vector<cmSourceFile const*>& data) const
::GetCustomCommands(std::vector<cmSourceFile const*>& data,
const std::string& config) const
{
IMPLEMENT_VISIT(CustomCommands);
}
......@@ -391,14 +407,16 @@ cmGeneratorTarget
//----------------------------------------------------------------------------
void
cmGeneratorTarget
::GetExternalObjects(std::vector<cmSourceFile const*>& data) const
::GetExternalObjects(std::vector<cmSourceFile const*>& data,
const std::string& config) const
{
IMPLEMENT_VISIT(ExternalObjects);
}
//----------------------------------------------------------------------------
void
cmGeneratorTarget::GetExpectedResxHeaders(std::set<std::string>& srcs) const
cmGeneratorTarget::GetExpectedResxHeaders(std::set<std::string>& srcs,
const std::string& config) const
{
ResxData data;
IMPLEMENT_VISIT_IMPL(Resx, COMMA cmGeneratorTarget::ResxData)
......@@ -407,7 +425,8 @@ cmGeneratorTarget::GetExpectedResxHeaders(std::set<std::string>& srcs) const
//----------------------------------------------------------------------------
void cmGeneratorTarget
::GetResxSources(std::vector<cmSourceFile const*>& srcs) const
::GetResxSources(std::vector<cmSourceFile const*>& srcs,
const std::string& config) const
{
ResxData data;
IMPLEMENT_VISIT_IMPL(Resx, COMMA cmGeneratorTarget::ResxData)
......@@ -517,13 +536,15 @@ bool cmGeneratorTarget::GetPropertyAsBool(const std::string& prop) const
}
//----------------------------------------------------------------------------
void cmGeneratorTarget::GetSourceFiles(std::vector<cmSourceFile*> &files) const
void cmGeneratorTarget::GetSourceFiles(std::vector<cmSourceFile*> &files,
const std::string& config) const
{
this->Target->GetSourceFiles(files);
this->Target->GetSourceFiles(files, config);
}
//----------------------------------------------------------------------------
std::string cmGeneratorTarget::GetModuleDefinitionFile() const
std::string
cmGeneratorTarget::GetModuleDefinitionFile(const std::string& config) const
{
std::string data;
IMPLEMENT_VISIT_IMPL(ModuleDefinitionFile, COMMA std::string)
......@@ -532,10 +553,11 @@ std::string cmGeneratorTarget::GetModuleDefinitionFile() const
//----------------------------------------------------------------------------
void
cmGeneratorTarget::UseObjectLibraries(std::vector<std::string>& objs) const
cmGeneratorTarget::UseObjectLibraries(std::vector<std::string>& objs,
const std::string &config) const
{
std::vector<cmSourceFile const*> objectFiles;
this->GetExternalObjects(objectFiles);
this->GetExternalObjects(objectFiles, config);
std::vector<cmTarget*> objectLibraries;
std::set<cmTarget*> emitted;
for(std::vector<cmSourceFile const*>::const_iterator
......@@ -559,7 +581,7 @@ cmGeneratorTarget::UseObjectLibraries(std::vector<std::string>& objs) const
cmGeneratorTarget* ogt =
this->GlobalGenerator->GetGeneratorTarget(objLib);
std::vector<cmSourceFile const*> objectSources;
ogt->GetObjectSources(objectSources);
ogt->GetObjectSources(objectSources, config);
for(std::vector<cmSourceFile const*>::const_iterator
si = objectSources.begin();
si != objectSources.end(); ++si)
......@@ -615,11 +637,22 @@ cmTargetTraceDependencies
if (this->Target->GetType() != cmTarget::INTERFACE_LIBRARY)
{
std::vector<std::string> sources;
this->Target->GetSourceFiles(sources);
std::vector<std::string> configs;
this->Makefile->GetConfigurations(configs);
if (configs.empty())
{
configs.push_back("");
}
for(std::vector<std::string>::const_iterator ci = configs.begin();
ci != configs.end(); ++ci)
{
this->Target->GetSourceFiles(sources, *ci);
}
std::set<std::string> emitted;
for(std::vector<std::string>::const_iterator si = sources.begin();
si != sources.end(); ++si)
{
if(this->SourcesQueued.insert(*si).second)
if(emitted.insert(*si).second && this->SourcesQueued.insert(*si).second)
{
this->SourceQueue.push(*si);
this->Makefile->GetOrCreateSource(*si);
......
......@@ -30,21 +30,30 @@ public:
std::string GetName() const;
const char *GetProperty(const std::string& prop) const;
bool GetPropertyAsBool(const std::string& prop) const;
void GetSourceFiles(std::vector<cmSourceFile*>& files) const;
void GetSourceFiles(std::vector<cmSourceFile*>& files,
const std::string& config) const;
void GetObjectSources(std::vector<cmSourceFile const*> &) const;
void GetObjectSources(std::vector<cmSourceFile const*> &,
const std::string& config) const;
const std::string& GetObjectName(cmSourceFile const* file);
bool HasExplicitObjectName(cmSourceFile const* file) const;
void AddExplicitObjectName(cmSourceFile const* sf);
void GetResxSources(std::vector<cmSourceFile const*>&) const;
void GetIDLSources(std::vector<cmSourceFile const*>&) const;
void GetExternalObjects(std::vector<cmSourceFile const*>&) const;
void GetHeaderSources(std::vector<cmSourceFile const*>&) const;
void GetExtraSources(std::vector<cmSourceFile const*>&) const;
void GetCustomCommands(std::vector<cmSourceFile const*>&) const;
void GetExpectedResxHeaders(std::set<std::string>&) const;
void GetResxSources(std::vector<cmSourceFile const*>&,
const std::string& config) const;
void GetIDLSources(std::vector<cmSourceFile const*>&,
const std::string& config) const;
void GetExternalObjects(std::vector<cmSourceFile const*>&,
const std::string& config) const;
void GetHeaderSources(std::vector<cmSourceFile const*>&,
const std::string& config) const;
void GetExtraSources(std::vector<cmSourceFile const*>&,
const std::string& config) const;
void GetCustomCommands(std::vector<cmSourceFile const*>&,
const std::string& config) const;
void GetExpectedResxHeaders(std::set<std::string>&,
const std::string& config) const;
void ComputeObjectMapping();
......@@ -53,14 +62,15 @@ public:
cmLocalGenerator* LocalGenerator;
cmGlobalGenerator const* GlobalGenerator;
std::string GetModuleDefinitionFile() const;
std::string GetModuleDefinitionFile(const std::string& config) const;
/** Full path with trailing slash to the top-level directory
holding object files for this target. Includes the build
time config name placeholder if needed for the generator. */
std::string ObjectDirectory;
void UseObjectLibraries(std::vector<std::string>& objs) const;
void UseObjectLibraries(std::vector<std::string>& objs,
const std::string& config) const;
void GetAppleArchs(const std::string& config,
std::vector<std::string>& archVec) const;
......
......@@ -2900,10 +2900,25 @@ void cmGlobalGenerator::WriteSummary(cmTarget* target)
// List the source files with any per-source labels.
fout << "# Source files and their labels\n";
std::vector<cmSourceFile*> sources;
target->GetSourceFiles(sources);
std::vector<std::string> configs;
target->GetMakefile()->GetConfigurations(configs);
if (configs.empty())
{
configs.push_back("");
}
for(std::vector<std::string>::const_iterator ci = configs.begin();
ci != configs.end(); ++ci)
{
target->GetSourceFiles(sources, *ci);
}
std::set<cmSourceFile*> emitted;
for(std::vector<cmSourceFile*>::const_iterator si = sources.begin();
si != sources.end(); ++si)
{
if (!emitted.insert(*si).second)
{
continue;
}
cmSourceFile* sf = *si;
fout << sf->GetFullPath() << "\n";
if(const char* svalue = sf->GetProperty("LABELS"))
......
......@@ -139,7 +139,8 @@ bool cmGlobalKdevelopGenerator
ti != targets.end(); ti++)
{
std::vector<cmSourceFile*> sources;
ti->second.GetSourceFiles(sources);
ti->second.GetSourceFiles(sources, ti->second.GetMakefile()
->GetSafeDefinition("CMAKE_BUILD_TYPE"));
for (std::vector<cmSourceFile*>::const_iterator si=sources.begin();
si!=sources.end(); si++)
{
......
......@@ -1081,7 +1081,8 @@ bool cmGlobalUnixMakefileGenerator3
::NeedRequiresStep(cmTarget const& target)
{
std::set<std::string> languages;
target.GetLanguages(languages);
target.GetLanguages(languages,
target.GetMakefile()->GetSafeDefinition("CMAKE_BUILD_TYPE"));
for(std::set<std::string>::const_iterator l = languages.begin();
l != languages.end(); ++l)
{
......
......@@ -815,7 +815,15 @@ cmGlobalVisualStudioGenerator::TargetIsFortranOnly(cmTarget const& target)
{
// check to see if this is a fortran build
std::set<std::string> languages;
target.GetLanguages(languages);
{
// Issue diagnostic if the source files depend on the config.
std::vector<cmSourceFile*> sources;
if (!target.GetConfigCommonSourceFiles(sources))
{
return false;
}
}
target.GetLanguages(languages, "");
if(languages.size() == 1)
{
if(*languages.begin() == "Fortran")
......
......@@ -984,7 +984,10 @@ cmGlobalXCodeGenerator::CreateXCodeTargets(cmLocalGenerator* gen,
// organize the sources
std::vector<cmSourceFile*> classes;
cmtarget.GetSourceFiles(classes);
if (!cmtarget.GetConfigCommonSourceFiles(classes))
{
return;
}
std::sort(classes.begin(), classes.end(), cmSourceFilePathCompare());
gtgt->ComputeObjectMapping();
......@@ -1043,7 +1046,7 @@ cmGlobalXCodeGenerator::CreateXCodeTargets(cmLocalGenerator* gen,
// the externalObjFiles above, except each one is not a cmSourceFile
// within the target.)
std::vector<std::string> objs;
gtgt->UseObjectLibraries(objs);
gtgt->UseObjectLibraries(objs, "");
for(std::vector<std::string>::const_iterator
oi = objs.begin(); oi != objs.end(); ++oi)
{
......@@ -1359,7 +1362,10 @@ void cmGlobalXCodeGenerator::CreateCustomCommands(cmXCodeObject* buildPhases,
}
std::vector<cmSourceFile*> classes;
cmtarget.GetSourceFiles(classes);
if (!cmtarget.GetConfigCommonSourceFiles(classes))
{
return;
}
// add all the sources
std::vector<cmCustomCommand> commands;
for(std::vector<cmSourceFile*>::const_iterator i = classes.begin();
......@@ -2439,7 +2445,11 @@ cmGlobalXCodeGenerator::CreateUtilityTarget(cmTarget& cmtarget)
if(cmtarget.GetType() == cmTarget::UTILITY)
{
std::vector<cmSourceFile*> sources;
cmtarget.GetSourceFiles(sources);
if (!cmtarget.GetConfigCommonSourceFiles(sources))
{
return 0;
}
for(std::vector<cmSourceFile*>::const_iterator i = sources.begin();
i != sources.end(); ++i)
{
......@@ -2808,7 +2818,7 @@ void cmGlobalXCodeGenerator
std::string linkObjs;
const char* sep = "";
std::vector<std::string> objs;
this->GetGeneratorTarget(cmtarget)->UseObjectLibraries(objs);
this->GetGeneratorTarget(cmtarget)->UseObjectLibraries(objs, "");
for(std::vector<std::string>::const_iterator
oi = objs.begin(); oi != objs.end(); ++oi)
{
......@@ -2943,8 +2953,10 @@ void cmGlobalXCodeGenerator::CreateGroups(cmLocalGenerator* root,
}
std::vector<cmSourceFile*> classes;
cmtarget.GetSourceFiles(classes);
if (!cmtarget.GetConfigCommonSourceFiles(classes))
{
return;
}
// Put cmSourceFile instances in proper groups:
for(std::vector<cmSourceFile*>::const_iterator s = classes.begin();
s != classes.end(); s++)
......@@ -2962,7 +2974,7 @@ void cmGlobalXCodeGenerator::CreateGroups(cmLocalGenerator* root,
// Put OBJECT_LIBRARY objects in proper groups:
std::vector<std::string> objs;
this->GetGeneratorTarget(&cmtarget)->UseObjectLibraries(objs);
this->GetGeneratorTarget(&cmtarget)->UseObjectLibraries(objs, "");
for(std::vector<std::string>::const_iterator
oi = objs.begin(); oi != objs.end(); ++oi)
{
......
......@@ -662,7 +662,8 @@ void cmLocalGenerator::AddBuildTargetRule(const std::string& llang,
std::vector<std::string> objVector;
// Add all the sources outputs to the depends of the target
std::vector<cmSourceFile*> classes;
target.GetSourceFiles(classes);
target.GetSourceFiles(classes,
this->Makefile->GetSafeDefinition("CMAKE_BUILD_TYPE"));
for(std::vector<cmSourceFile*>::const_iterator i = classes.begin();
i != classes.end(); ++i)
{
......@@ -1644,7 +1645,7 @@ void cmLocalGenerator::GetTargetFlags(std::string& linkLibs,
!(this->Makefile->IsOn("CYGWIN") || this->Makefile->IsOn("MINGW")))
{
std::vector<cmSourceFile*> sources;
target->GetSourceFiles(sources);
target->GetSourceFiles(sources, buildType);
for(std::vector<cmSourceFile*>::const_iterator i = sources.begin();
i != sources.end(); ++i)
{
......@@ -1692,7 +1693,7 @@ void cmLocalGenerator::GetTargetFlags(std::string& linkLibs,
linkFlags += this->Makefile->GetSafeDefinition(build);
linkFlags += " ";
}
std::string linkLanguage = target->Target->GetLinkerLanguage();
std::string linkLanguage = target->Target->GetLinkerLanguage(buildType);
if(linkLanguage.empty())
{
cmSystemTools::Error
......
......@@ -200,7 +200,8 @@ GetLocalObjectFiles(std::map<std::string, LocalObjectInfo> &localObjectFiles)
continue;
}
std::vector<cmSourceFile const*> objectSources;
gt->GetObjectSources(objectSources);
gt->GetObjectSources(objectSources, this->Makefile
->GetSafeDefinition("CMAKE_BUILD_TYPE"));
// Compute full path to object file directory for this target.
std::string dir;
dir += gt->Makefile->GetCurrentOutputDirectory();
......@@ -1262,7 +1263,8 @@ cmLocalUnixMakefileGenerator3
{
// Get the set of source languages in the target.
std::set<std::string> languages;
target.GetLanguages(languages);
target.GetLanguages(languages,
this->Makefile->GetSafeDefinition("CMAKE_BUILD_TYPE"));
fout << "\n"
<< "# Per-language clean rules from dependency scanning.\n"
<< "foreach(lang";
......
......@@ -317,7 +317,10 @@ void cmLocalVisualStudio6Generator::WriteDSPFile(std::ostream& fout,
// get the classes from the source lists then add them to the groups
std::vector<cmSourceFile*> classes;
target.GetSourceFiles(classes);
if (!target.GetConfigCommonSourceFiles(classes))
{
return;
}
// now all of the source files have been properly assigned to the target
// now stick them into source groups using the reg expressions
......@@ -1269,7 +1272,20 @@ void cmLocalVisualStudio6Generator
if(targetBuilds)
{
// Get the language to use for linking.
const std::string& linkLanguage = target.GetLinkerLanguage();
std::vector<std::string> configs;
target.GetMakefile()->GetConfigurations(configs);
std::vector<std::string>::const_iterator it = configs.begin();
const std::string& linkLanguage = target.GetLinkerLanguage(*it);
for ( ; it != configs.end(); ++it)
{
const std::string& configLinkLanguage = target.GetLinkerLanguage(*it);
if (configLinkLanguage != linkLanguage)
{
cmSystemTools::Error
("Linker language must not vary by configuration for target: ",
target.GetName().c_str());
}
}
if(linkLanguage.empty())
{
cmSystemTools::Error
......@@ -1691,7 +1707,20 @@ void cmLocalVisualStudio6Generator
if(target.GetType() >= cmTarget::EXECUTABLE &&
target.GetType() <= cmTarget::OBJECT_LIBRARY)
{
const std::string& linkLanguage = target.GetLinkerLanguage();
std::vector<std::string> configs;
target.GetMakefile()->GetConfigurations(configs);
std::vector<std::string>::const_iterator it = configs.begin();
const std::string& linkLanguage = target.GetLinkerLanguage(*it);
for ( ; it != configs.end(); ++it)
{
const std::string& configLinkLanguage = target.GetLinkerLanguage(*it);
if (configLinkLanguage != linkLanguage)
{
cmSystemTools::Error
("Linker language must not vary by configuration for target: ",
target.GetName().c_str());
}
}
if(linkLanguage.empty())
{
cmSystemTools::Error
......@@ -1889,7 +1918,7 @@ void cmLocalVisualStudio6Generator
cmGeneratorTarget* gt =
this->GlobalGenerator->GetGeneratorTarget(&target);
std::vector<std::string> objs;
gt->UseObjectLibraries(objs);
gt->UseObjectLibraries(objs, "");
for(std::vector<std::string>::const_iterator
oi = objs.begin(); oi != objs.end(); ++oi)
{
......
......@@ -1330,7 +1330,7 @@ cmLocalVisualStudio7GeneratorInternals
cmGeneratorTarget* gt =
lg->GetGlobalGenerator()->GetGeneratorTarget(t);
std::vector<std::string> objs;
gt->UseObjectLibraries(objs);
gt->UseObjectLibraries(objs, "");
const char* sep = isep? isep : "";
for(std::vector<std::string>::const_iterator
oi = objs.begin(); oi != objs.end(); ++oi)
......@@ -1397,7 +1397,10 @@ void cmLocalVisualStudio7Generator::WriteVCProjFile(std::ostream& fout,
// get the classes from the source lists then add them to the groups
this->ModuleDefinitionFile = "";
std::vector<cmSourceFile*> classes;
target.GetSourceFiles(classes);
if (!target.GetConfigCommonSourceFiles(classes))
{
return;
}
for(std::vector<cmSourceFile*>::const_iterator i = classes.begin();
i != classes.end(); i++)
{
......@@ -1438,7 +1441,7 @@ void cmLocalVisualStudio7Generator::WriteVCProjFile(std::ostream& fout,
cmGeneratorTarget* gt =
this->GlobalGenerator->GetGeneratorTarget(&target);
std::vector<std::string> objs;
gt->UseObjectLibraries(objs);
gt->UseObjectLibraries(objs, "");
if(!objs.empty())
{
// TODO: Separate sub-filter for each object library used?
......
......@@ -128,14 +128,15 @@ void cmMakefileTargetGenerator::CreateRuleFile()
//----------------------------------------------------------------------------
void cmMakefileTargetGenerator::WriteTargetBuildRules()
{
const std::string& config =
this->Makefile->GetSafeDefinition("CMAKE_BUILD_TYPE");
// write the custom commands for this target
// Look for files registered for cleaning in this directory.
if(const char* additional_clean_files =
this->Makefile->GetProperty
("ADDITIONAL_MAKE_CLEAN_FILES"))
{
const std::string& config =
this->Makefile->GetDefinition("CMAKE_BUILD_TYPE");
cmListFileBacktrace lfbt;
cmGeneratorExpression ge(lfbt);
cmsys::auto_ptr<cmCompiledGeneratorExpression> cge =
......@@ -154,7 +155,7 @@ void cmMakefileTargetGenerator::WriteTargetBuildRules()
// First generate the object rule files. Save a list of all object
// files for this target.
std::vector<cmSourceFile const*> customCommands;
this->GeneratorTarget->GetCustomCommands(customCommands);
this->GeneratorTarget->GetCustomCommands(customCommands, config);
for(std::vector<cmSourceFile const*>::const_iterator
si = customCommands.begin();
si != customCommands.end(); ++si)
......@@ -177,17 +178,17 @@ void cmMakefileTargetGenerator::WriteTargetBuildRules()
}
}
std::vector<cmSourceFile const*> headerSources;
this->GeneratorTarget->GetHeaderSources(headerSources);
this->GeneratorTarget->GetHeaderSources(headerSources, config);
this->OSXBundleGenerator->GenerateMacOSXContentStatements(
headerSources,
this->MacOSXContentGenerator);
std::vector<cmSourceFile const*> extraSources;
this->GeneratorTarget->GetExtraSources(extraSources);
this->GeneratorTarget->GetExtraSources(extraSources, config);
this->OSXBundleGenerator->GenerateMacOSXContentStatements(
extraSources,
this->MacOSXContentGenerator);
std::vector<cmSourceFile const*> externalObjects;
this->GeneratorTarget->GetExternalObjects(externalObjects);
this->GeneratorTarget->GetExternalObjects(externalObjects, config);
for(std::vector<cmSourceFile const*>::const_iterator
si = externalObjects.begin();
si != externalObjects.end(); ++si)
......@@ -195,7 +196,7 @@ void cmMakefileTargetGenerator::WriteTargetBuildRules()