summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorAndy Cedilnik <andy.cedilnik@kitware.com>2005-07-28 18:52:16 (GMT)
committerAndy Cedilnik <andy.cedilnik@kitware.com>2005-07-28 18:52:16 (GMT)
commit47e22fe04139c3cbf54c2fae71ef6cb0ab97f231 (patch)
treebe2940b45f05729f81a5c3c89da7ac9668e2338d /Source
parent6e4b6ca0d3547319887b07e60957553f19666429 (diff)
downloadCMake-47e22fe04139c3cbf54c2fae71ef6cb0ab97f231.zip
CMake-47e22fe04139c3cbf54c2fae71ef6cb0ab97f231.tar.gz
CMake-47e22fe04139c3cbf54c2fae71ef6cb0ab97f231.tar.bz2
ENH: make sure c flags are used for c and cxx flags are used for cxx, really Bill
Diffstat (limited to 'Source')
-rw-r--r--Source/cmGlobalXCodeGenerator.cxx41
1 files changed, 34 insertions, 7 deletions
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index 5009568..cc39638 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -892,25 +892,33 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
{
this->ConfigureOutputPaths();
std::string flags;
+ std::string defFlags;
bool shared = ((target.GetType() == cmTarget::SHARED_LIBRARY) ||
(target.GetType() == cmTarget::MODULE_LIBRARY));
if(shared)
{
- flags += "-D";
+ defFlags += "-D";
if(const char* custom_export_name = target.GetProperty("DEFINE_SYMBOL"))
{
- flags += custom_export_name;
+ defFlags += custom_export_name;
}
else
{
std::string in = target.GetName();
in += "_EXPORTS";
- flags += cmSystemTools::MakeCindentifier(in.c_str());
+ defFlags += cmSystemTools::MakeCindentifier(in.c_str());
}
}
const char* lang = target.GetLinkerLanguage(this);
+ std::string cflags;
if(lang)
{
+ // for c++ projects get the c flags as well
+ if(strcmp(lang, "CXX") == 0)
+ {
+ m_CurrentLocalGenerator->AddLanguageFlags(cflags, "C");
+ m_CurrentLocalGenerator->AddSharedFlags(cflags, lang, shared);
+ }
// Add language-specific flags.
m_CurrentLocalGenerator->AddLanguageFlags(flags, lang);
@@ -919,12 +927,14 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
}
// Add define flags
- m_CurrentLocalGenerator->AppendFlags(flags,
+ m_CurrentLocalGenerator->AppendFlags(defFlags,
m_CurrentMakefile->GetDefineFlags());
+ cmSystemTools::ReplaceString(defFlags, "\"", "\\\"");
cmSystemTools::ReplaceString(flags, "\"", "\\\"");
+ cmSystemTools::ReplaceString(cflags, "\"", "\\\"");
if(m_XcodeVersion == 21)
{
- flags += " -DCMAKE_INTDIR=\\\\\\\"$(CONFIGURATION)\\\\\\\" ";
+ defFlags += " -DCMAKE_INTDIR=\\\\\\\"$(CONFIGURATION)\\\\\\\" ";
}
productName = target.GetName();
@@ -1063,8 +1073,25 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
this->CreateString(""));
buildSettings->AddAttribute("OPTIMIZATION_CFLAGS",
this->CreateString(""));
- buildSettings->AddAttribute("OTHER_CFLAGS",
- this->CreateString(flags.c_str()));
+ if(lang && strcmp(lang, "CXX") == 0)
+ {
+ flags += " ";
+ flags += defFlags;
+ buildSettings->AddAttribute("OTHER_CPLUSPLUSFLAGS",
+ this->CreateString(flags.c_str()));
+ cflags += " ";
+ cflags += defFlags;
+ buildSettings->AddAttribute("OTHER_CFLAGS",
+ this->CreateString(cflags.c_str()));
+
+ }
+ else
+ {
+ flags += " ";
+ flags += defFlags;
+ buildSettings->AddAttribute("OTHER_CFLAGS",
+ this->CreateString(flags.c_str()));
+ }
buildSettings->AddAttribute("OTHER_LDFLAGS",
this->CreateString(""));
buildSettings->AddAttribute("OTHER_REZFLAGS",