diff options
author | Bill Hoffman <bill.hoffman@kitware.com> | 2005-12-19 16:29:57 (GMT) |
---|---|---|
committer | Bill Hoffman <bill.hoffman@kitware.com> | 2005-12-19 16:29:57 (GMT) |
commit | 5261f51e45b431fdb8d5a382c3d0ee9c4e42ebba (patch) | |
tree | 7e53aaee33295591a81dd6f14c30afc940dc8f27 /Source | |
parent | 64f7c3c41caf186e01996ebd59a88580b07e4ce3 (diff) | |
download | CMake-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')
-rw-r--r-- | Source/CTest/cmCTestBuildAndTestHandler.cxx | 8 | ||||
-rw-r--r-- | Source/cmGlobalXCodeGenerator.cxx | 58 |
2 files changed, 43 insertions, 23 deletions
diff --git a/Source/CTest/cmCTestBuildAndTestHandler.cxx b/Source/CTest/cmCTestBuildAndTestHandler.cxx index 10420af..cf1dfeb 100644 --- a/Source/CTest/cmCTestBuildAndTestHandler.cxx +++ b/Source/CTest/cmCTestBuildAndTestHandler.cxx @@ -229,6 +229,14 @@ int cmCTestBuildAndTestHandler::RunCMakeAndTest(std::string* outstring) tempPath += "/"; tempPath += filename; attempted.push_back(tempPath); + // If the file is an OSX bundle then the configtyp + // will be at the start of the path + tempPath = m_CTest->GetConfigType(); + tempPath += "/"; + tempPath += filepath; + tempPath += "/"; + tempPath += filename; + attempted.push_back(tempPath); } } // otherwise search local dirs 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", |