summaryrefslogtreecommitdiffstats
path: root/Source/cmMakefileTargetGenerator.cxx
diff options
context:
space:
mode:
authorStephen Kelly <steveire@gmail.com>2014-02-13 16:25:00 (GMT)
committerStephen Kelly <steveire@gmail.com>2014-04-02 21:14:02 (GMT)
commite6971df6ab647031ba9689c9afbbde78cc62e35f (patch)
treec9c67c6e3a1627d65cda8ee93373b97403c92106 /Source/cmMakefileTargetGenerator.cxx
parentdf753df94bb1e995372baabb0240585560c72ded (diff)
downloadCMake-e6971df6ab647031ba9689c9afbbde78cc62e35f.zip
CMake-e6971df6ab647031ba9689c9afbbde78cc62e35f.tar.gz
CMake-e6971df6ab647031ba9689c9afbbde78cc62e35f.tar.bz2
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.
Diffstat (limited to 'Source/cmMakefileTargetGenerator.cxx')
-rw-r--r--Source/cmMakefileTargetGenerator.cxx29
1 files changed, 17 insertions, 12 deletions
diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx
index c520f9e..2d55621 100644
--- a/Source/cmMakefileTargetGenerator.cxx
+++ b/Source/cmMakefileTargetGenerator.cxx
@@ -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()
this->ExternalObjects.push_back((*si)->GetFullPath());
}
std::vector<cmSourceFile const*> objectSources;
- this->GeneratorTarget->GetObjectSources(objectSources);
+ this->GeneratorTarget->GetObjectSources(objectSources, config);
for(std::vector<cmSourceFile const*>::const_iterator
si = objectSources.begin(); si != objectSources.end(); ++si)
{
@@ -344,7 +345,8 @@ void cmMakefileTargetGenerator::WriteTargetLanguageFlags()
{
// write language flags for target
std::set<std::string> languages;
- this->Target->GetLanguages(languages);
+ this->Target->GetLanguages(languages,
+ this->Makefile->GetSafeDefinition("CMAKE_BUILD_TYPE"));
// put the compiler in the rules.make file so that if it changes
// things rebuild
for(std::set<std::string>::const_iterator l = languages.begin();
@@ -1173,7 +1175,8 @@ cmMakefileTargetGenerator
{
// Depend on all custom command outputs.
std::vector<cmSourceFile*> sources;
- this->Target->GetSourceFiles(sources);
+ this->Target->GetSourceFiles(sources,
+ this->Makefile->GetSafeDefinition("CMAKE_BUILD_TYPE"));
for(std::vector<cmSourceFile*>::const_iterator source = sources.begin();
source != sources.end(); ++source)
{
@@ -1670,7 +1673,8 @@ void cmMakefileTargetGenerator
this->AppendTargetDepends(depends);
// Add a dependency on the link definitions file, if any.
- std::string def = this->GeneratorTarget->GetModuleDefinitionFile();
+ std::string def = this->GeneratorTarget->GetModuleDefinitionFile(
+ this->Makefile->GetSafeDefinition("CMAKE_BUILD_TYPE"));
if(!def.empty())
{
depends.push_back(def);
@@ -2064,7 +2068,7 @@ void cmMakefileTargetGenerator::AddFortranFlags(std::string& flags)
{
std::vector<std::string> includes;
const std::string& config =
- this->Makefile->GetDefinition("CMAKE_BUILD_TYPE");
+ this->Makefile->GetSafeDefinition("CMAKE_BUILD_TYPE");
this->LocalGenerator->GetIncludeDirectories(includes,
this->GeneratorTarget,
"C", config);
@@ -2083,7 +2087,8 @@ void cmMakefileTargetGenerator::AddFortranFlags(std::string& flags)
//----------------------------------------------------------------------------
void cmMakefileTargetGenerator::AddModuleDefinitionFlag(std::string& flags)
{
- std::string def = this->GeneratorTarget->GetModuleDefinitionFile();
+ std::string def = this->GeneratorTarget->GetModuleDefinitionFile(
+ this->Makefile->GetSafeDefinition("CMAKE_BUILD_TYPE"));
if(def.empty())
{
return;