summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2006-02-24 16:13:31 (GMT)
committerBrad King <brad.king@kitware.com>2006-02-24 16:13:31 (GMT)
commit576f0b65c739bc719d493d66fc25c90404067943 (patch)
tree2761d2f453ff14102cff51bec8dd6e1b1a7aaaaf /Source
parentf437c8e888db7a934792371e74fd7c15b71ec34f (diff)
downloadCMake-576f0b65c739bc719d493d66fc25c90404067943.zip
CMake-576f0b65c739bc719d493d66fc25c90404067943.tar.gz
CMake-576f0b65c739bc719d493d66fc25c90404067943.tar.bz2
BUG: Fix generation of Xcode 2.0 and earlier projects to use CMAKE_BUILD_TYPE.
Diffstat (limited to 'Source')
-rw-r--r--Source/cmGlobalXCodeGenerator.cxx33
-rw-r--r--Source/cmLocalGenerator.cxx17
-rw-r--r--Source/cmLocalGenerator.h6
-rw-r--r--Source/cmMakefileExecutableTargetGenerator.cxx7
-rw-r--r--Source/cmMakefileLibraryTargetGenerator.cxx6
-rw-r--r--Source/cmMakefileTargetGenerator.cxx4
6 files changed, 42 insertions, 31 deletions
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index 2a81cf2..273c98c 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -1031,27 +1031,18 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
std::string cflags;
if(lang)
{
- // Temporarily set the CMAKE_BUILD_TYPE so the local generator can use
- // it. TODO: The local generator methods should take the configuration
- // name as input.
- if(configName)
- {
- m_CurrentMakefile->AddDefinition("CMAKE_BUILD_TYPE", configName);
- }
// for c++ projects get the c flags as well
if(strcmp(lang, "CXX") == 0)
{
- m_CurrentLocalGenerator->AddLanguageFlags(cflags, "C");
+ m_CurrentLocalGenerator->AddLanguageFlags(cflags, "C", configName);
m_CurrentLocalGenerator->AddSharedFlags(cflags, lang, shared);
}
+
// Add language-specific flags.
- m_CurrentLocalGenerator->AddLanguageFlags(flags, lang);
+ m_CurrentLocalGenerator->AddLanguageFlags(flags, lang, configName);
// Add shared-library flags if needed.
m_CurrentLocalGenerator->AddSharedFlags(flags, lang, shared);
-
- // Remove the temporary CMAKE_BUILD_TYPE definition.
- m_CurrentMakefile->AddDefinition("CMAKE_BUILD_TYPE", "");
}
// Add define flags
@@ -1364,13 +1355,18 @@ cmGlobalXCodeGenerator::CreateUtilityTarget(cmTarget& cmtarget)
std::string fileTypeString;
std::string productTypeString;
std::string productName;
- this->CreateBuildSettings(cmtarget,
- buildSettings, fileTypeString,
- productTypeString, productName, 0);
+ const char* globalConfig = 0;
if(m_XcodeVersion > 20)
{
this->AddConfigurations(target, cmtarget);
}
+ else
+ {
+ globalConfig = m_CurrentMakefile->GetDefinition("CMAKE_BUILD_TYPE");
+ }
+ this->CreateBuildSettings(cmtarget,
+ buildSettings, fileTypeString,
+ productTypeString, productName, globalConfig);
target->AddAttribute("buildSettings", buildSettings);
cmXCodeObject* dependencies = this->CreateObject(cmXCodeObject::OBJECT_LIST);
target->AddAttribute("dependencies", dependencies);
@@ -1441,13 +1437,18 @@ cmGlobalXCodeGenerator::CreateXCodeTarget(cmTarget& cmtarget,
std::string fileTypeString;
std::string productTypeString;
std::string productName;
+ const char* globalConfig = 0;
if(m_XcodeVersion > 20)
{
this->AddConfigurations(target, cmtarget);
}
+ else
+ {
+ globalConfig = m_CurrentMakefile->GetDefinition("CMAKE_BUILD_TYPE");
+ }
this->CreateBuildSettings(cmtarget,
buildSettings, fileTypeString,
- productTypeString, productName, 0);
+ productTypeString, productName, globalConfig);
target->AddAttribute("buildSettings", buildSettings);
cmXCodeObject* dependencies = this->CreateObject(cmXCodeObject::OBJECT_LIST);
target->AddAttribute("dependencies", dependencies);
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index 24128ba..1f6a596 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -1349,13 +1349,14 @@ cmLocalGenerator::ComputeLinkInformation(cmTarget& target,
//----------------------------------------------------------------------------
void cmLocalGenerator::AddLanguageFlags(std::string& flags,
- const char* lang)
+ const char* lang,
+ const char* config)
{
// Add language-specific flags.
std::string flagsVar = "CMAKE_";
flagsVar += lang;
flagsVar += "_FLAGS";
- this->AddConfigVariableFlags(flags, flagsVar.c_str());
+ this->AddConfigVariableFlags(flags, flagsVar.c_str(), config);
}
//----------------------------------------------------------------------------
@@ -1417,8 +1418,8 @@ std::string cmLocalGenerator::GetRealDependency(const char* inName,
//----------------------------------------------------------------------------
void cmLocalGenerator::AddSharedFlags(std::string& flags,
- const char* lang,
- bool shared)
+ const char* lang,
+ bool shared)
{
std::string flagsVar;
@@ -1443,18 +1444,18 @@ void cmLocalGenerator::AddSharedFlags(std::string& flags,
//----------------------------------------------------------------------------
void cmLocalGenerator::AddConfigVariableFlags(std::string& flags,
- const char* var)
+ const char* var,
+ const char* config)
{
// Add the flags from the variable itself.
std::string flagsVar = var;
this->AppendFlags(flags, m_Makefile->GetDefinition(flagsVar.c_str()));
// Add the flags from the build-type specific variable.
- const char* buildType = m_Makefile->GetDefinition("CMAKE_BUILD_TYPE");
- if(buildType && *buildType)
+ if(config && *config)
{
flagsVar += "_";
- flagsVar += cmSystemTools::UpperCase(buildType);
+ flagsVar += cmSystemTools::UpperCase(config);
this->AppendFlags(flags, m_Makefile->GetDefinition(flagsVar.c_str()));
}
}
diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h
index aca74ea..7260513 100644
--- a/Source/cmLocalGenerator.h
+++ b/Source/cmLocalGenerator.h
@@ -127,9 +127,11 @@ public:
std::vector<cmLocalGenerator*>& GetChildren() { return this->Children; };
- void AddLanguageFlags(std::string& flags, const char* lang);
+ void AddLanguageFlags(std::string& flags, const char* lang,
+ const char* config);
void AddSharedFlags(std::string& flags, const char* lang, bool shared);
- void AddConfigVariableFlags(std::string& flags, const char* var);
+ void AddConfigVariableFlags(std::string& flags, const char* var,
+ const char* config);
void AppendFlags(std::string& flags, const char* newFlags);
///! Get the include flags for the current makefile and language
const char* GetIncludeFlags(const char* lang);
diff --git a/Source/cmMakefileExecutableTargetGenerator.cxx b/Source/cmMakefileExecutableTargetGenerator.cxx
index 5399151..b763349 100644
--- a/Source/cmMakefileExecutableTargetGenerator.cxx
+++ b/Source/cmMakefileExecutableTargetGenerator.cxx
@@ -187,7 +187,8 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
// Add flags to create an executable.
this->LocalGenerator->
- AddConfigVariableFlags(linkFlags, "CMAKE_EXE_LINKER_FLAGS");
+ AddConfigVariableFlags(linkFlags, "CMAKE_EXE_LINKER_FLAGS",
+ this->LocalGenerator->m_ConfigurationName.c_str());
if(this->Target->GetPropertyAsBool("WIN32_EXECUTABLE"))
@@ -202,7 +203,9 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
}
// Add language-specific flags.
- this->LocalGenerator->AddLanguageFlags(flags, linkLanguage);
+ this->LocalGenerator
+ ->AddLanguageFlags(flags, linkLanguage,
+ this->LocalGenerator->m_ConfigurationName.c_str());
// Add target-specific linker flags.
this->LocalGenerator->AppendFlags(linkFlags, this->Target->GetProperty("LINK_FLAGS"));
diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx
index b18895f..d8bc80e 100644
--- a/Source/cmMakefileLibraryTargetGenerator.cxx
+++ b/Source/cmMakefileLibraryTargetGenerator.cxx
@@ -109,7 +109,8 @@ void cmMakefileLibraryTargetGenerator::WriteSharedLibraryRules(bool relink)
std::string extraFlags;
this->LocalGenerator->AppendFlags(extraFlags, this->Target->GetProperty("LINK_FLAGS"));
- this->LocalGenerator->AddConfigVariableFlags(extraFlags, "CMAKE_SHARED_LINKER_FLAGS");
+ this->LocalGenerator->AddConfigVariableFlags(extraFlags, "CMAKE_SHARED_LINKER_FLAGS",
+ this->LocalGenerator->m_ConfigurationName.c_str());
if(this->Makefile->IsOn("WIN32") && !(this->Makefile->IsOn("CYGWIN") || this->Makefile->IsOn("MINGW")))
{
const std::vector<cmSourceFile*>& sources = this->Target->GetSourceFiles();
@@ -142,7 +143,8 @@ void cmMakefileLibraryTargetGenerator::WriteModuleLibraryRules(bool relink)
std::string extraFlags;
this->LocalGenerator->AppendFlags(extraFlags, this->Target->GetProperty("LINK_FLAGS"));
- this->LocalGenerator->AddConfigVariableFlags(extraFlags, "CMAKE_MODULE_LINKER_FLAGS");
+ this->LocalGenerator->AddConfigVariableFlags(extraFlags, "CMAKE_MODULE_LINKER_FLAGS",
+ this->LocalGenerator->m_ConfigurationName.c_str());
// TODO: .def files should be supported here also.
this->WriteLibraryRules(linkRuleVar.c_str(), extraFlags.c_str(), relink);
}
diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx
index a21fe4e..e400163 100644
--- a/Source/cmMakefileTargetGenerator.cxx
+++ b/Source/cmMakefileTargetGenerator.cxx
@@ -219,7 +219,9 @@ void cmMakefileTargetGenerator::WriteCommonCodeRules()
}
// Add language-specific flags.
- this->LocalGenerator->AddLanguageFlags(flags, lang);
+ this->LocalGenerator
+ ->AddLanguageFlags(flags, lang,
+ this->LocalGenerator->m_ConfigurationName.c_str());
// Add shared-library flags if needed.
this->LocalGenerator->AddSharedFlags(flags, lang, shared);