summaryrefslogtreecommitdiffstats
path: root/Source/cmGlobalXCodeGenerator.cxx
diff options
context:
space:
mode:
authorBill Hoffman <bill.hoffman@kitware.com>2005-12-19 16:29:57 (GMT)
committerBill Hoffman <bill.hoffman@kitware.com>2005-12-19 16:29:57 (GMT)
commit5261f51e45b431fdb8d5a382c3d0ee9c4e42ebba (patch)
tree7e53aaee33295591a81dd6f14c30afc940dc8f27 /Source/cmGlobalXCodeGenerator.cxx
parent64f7c3c41caf186e01996ebd59a88580b07e4ce3 (diff)
downloadCMake-5261f51e45b431fdb8d5a382c3d0ee9c4e42ebba.zip
CMake-5261f51e45b431fdb8d5a382c3d0ee9c4e42ebba.tar.gz
CMake-5261f51e45b431fdb8d5a382c3d0ee9c4e42ebba.tar.bz2
BUG: fix for bug 2560, Xcode does not create correct bundles
Diffstat (limited to 'Source/cmGlobalXCodeGenerator.cxx')
-rw-r--r--Source/cmGlobalXCodeGenerator.cxx58
1 files changed, 35 insertions, 23 deletions
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index 06d3f1b..95b7c1d 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -1003,10 +1003,36 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
cmSystemTools::ReplaceString(cflags, "\"", "\\\"");
if(m_XcodeVersion > 15)
{
- defFlags += " -DCMAKE_INTDIR=\\\\\\\"$(CONFIGURATION)\\\\\\\" ";
+ buildSettings->
+ AddAttribute("GCC_PREPROCESSOR_DEFINITIONS",
+ this->CreateString("CMAKE_INTDIR=\\\\\\\"$(CONFIGURATION)\\\\\\\""));
+
}
productName = target.GetName();
+ std::string extraLinkOptions;
+ if(target.GetType() == cmTarget::EXECUTABLE)
+ {
+ extraLinkOptions =
+ m_CurrentMakefile->GetRequiredDefinition("CMAKE_EXE_LINKER_FLAGS");
+ }
+ if(target.GetType() == cmTarget::SHARED_LIBRARY)
+ {
+ extraLinkOptions =
+ m_CurrentMakefile->GetRequiredDefinition("CMAKE_SHARED_LINKER_FLAGS");
+ }
+ if(target.GetType() == cmTarget::MODULE_LIBRARY)
+ {
+ extraLinkOptions =
+ m_CurrentMakefile->GetRequiredDefinition("CMAKE_MODULE_LINKER_FLAGS");
+ }
+ const char* targetLinkFlags = target.GetProperty("LINK_FLAGS");
+ if(targetLinkFlags)
+ {
+ extraLinkOptions += " ";
+ extraLinkOptions += targetLinkFlags;
+ }
+
switch(target.GetType())
{
case cmTarget::STATIC_LIBRARY:
@@ -1060,15 +1086,14 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
std::string outflag = "-o \\\"$(CONFIGURATION_BUILD_DIR)/";
outflag += productName;
outflag += "\\\"";
- buildSettings->AddAttribute("OTHER_LDFLAGS",
- this->CreateString(outflag.c_str()));
+ extraLinkOptions += " ";
+ extraLinkOptions += outflag;
productType = "com.apple.product-type.tool";
fileType = "compiled.mach-o.executable";
}
else
{
- buildSettings->AddAttribute("OTHER_LDFLAGS",
- this->CreateString("-bundle"));
+ extraLinkOptions += " -bundle";
productType = "com.apple.product-type.library.dynamic";
fileType = "compiled.mach-o.dylib";
}
@@ -1092,8 +1117,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
this->CreateString("1"));
buildSettings->AddAttribute("DYLIB_CURRENT_VERSION",
this->CreateString("1"));
- buildSettings->AddAttribute("OTHER_LDFLAGS",
- this->CreateString("-dynamiclib"));
+ extraLinkOptions += " -dynamiclib";
productType = "com.apple.product-type.library.dynamic";
fileType = "compiled.mach-o.dylib";
break;
@@ -1115,22 +1139,12 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
if(m_ExecutableOutputPath.size())
{
std::string path = m_ExecutableOutputPath;
- if(target.GetPropertyAsBool("MACOSX_BUNDLE"))
- {
- path += name;
- path += ".app/Contents/MacOS/";
- }
symRoot = path;
}
fileType = "compiled.mach-o.executable";
if(target.GetPropertyAsBool("MACOSX_BUNDLE"))
{
- if(symRoot.size() == 0)
- {
- symRoot = name;
- symRoot += ".app/Contents/MacOS/";
- }
- productType = "com.apple.product-type.tool";
+ productType = "com.apple.product-type.application";
}
else
{
@@ -1223,11 +1237,9 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
buildSettings->AddAttribute("OTHER_CFLAGS",
this->CreateString(flags.c_str()));
}
- if(!buildSettings->GetObject("OTHER_LDFLAGS"))
- {
- buildSettings->AddAttribute("OTHER_LDFLAGS",
- this->CreateString(""));
- }
+ buildSettings->AddAttribute("OTHER_LDFLAGS",
+ this->CreateString(extraLinkOptions.c_str()));
+
buildSettings->AddAttribute("OTHER_REZFLAGS",
this->CreateString(""));
buildSettings->AddAttribute("SECTORDER_FLAGS",