diff options
-rw-r--r-- | Source/cmGlobalXCodeGenerator.cxx | 22 | ||||
-rw-r--r-- | Source/cmXCodeObject.cxx | 8 |
2 files changed, 28 insertions, 2 deletions
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 0c45dbc..2499aff 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -35,6 +35,7 @@ void cmGlobalXCodeGenerator::EnableLanguage(std::vector<std::string>const& lang, { mf->AddDefinition("CMAKE_GENERATOR_CC", "gcc"); mf->AddDefinition("CMAKE_GENERATOR_CXX", "g++"); + mf->AddDefinition("CMAKE_GENERATOR_NO_COMPILER_ENV", "1"); this->cmGlobalGenerator::EnableLanguage(lang, mf); } @@ -64,6 +65,7 @@ int cmGlobalXCodeGenerator::TryCompile(const char *, */ std::string cwd = cmSystemTools::GetCurrentWorkingDirectory(); cmSystemTools::ChangeDirectory(bindir); + std::cerr << "ChangeDirectory " << bindir << "\n"; // Usage: xcodebuild [-project <projectname>] [-activetarget] // [-alltargets] [-target <targetname>]... [-activebuildstyle] // [-buildstyle <buildstylename>] [-optionalbuildstyle <buildstylename>] @@ -72,13 +74,14 @@ int cmGlobalXCodeGenerator::TryCompile(const char *, makeCommand += " -project "; makeCommand += projectName; + makeCommand += ".xcode"; makeCommand += " build "; if (targetName) { makeCommand += "-target "; makeCommand += targetName; } - + makeCommand += " -buildstyle Development "; int retVal; int timeout = cmGlobalGenerator::s_TryCompileTimeout; if (!cmSystemTools::RunSingleCommand(makeCommand.c_str(), output, &retVal, @@ -89,6 +92,8 @@ int cmGlobalXCodeGenerator::TryCompile(const char *, cmSystemTools::ChangeDirectory(cwd.c_str()); return 1; } + std::cerr << makeCommand << "\n"; + std::cerr << "build worked " << retVal << "\n";; cmSystemTools::ChangeDirectory(cwd.c_str()); return retVal; } @@ -167,8 +172,21 @@ cmGlobalXCodeGenerator::CreateXCodeSourceFile(cmLocalGenerator* lg, cmXCodeObject* settings = this->CreateObject(cmXCodeObject::ATTRIBUTE_GROUP); buildFile->AddAttribute("settings", settings); fileRef->AddAttribute("fileEncoding", this->CreateString("4")); + std::string lang = + this->GetLanguageFromExtension(sf->GetSourceExtension().c_str()); + std::string sourcecode = "sourcecode"; + if(lang == "C") + { + sourcecode += ".c.c"; + } + // default to c++ + else + { + sourcecode += ".cpp.cpp"; + } + fileRef->AddAttribute("lastKnownFileType", - this->CreateString("sourcecode.cpp.cpp")); + this->CreateString(sourcecode.c_str())); fileRef->AddAttribute("path", this->CreateString( lg->ConvertToRelativeOutputPath(sf->GetFullPath().c_str()).c_str())); fileRef->AddAttribute("refType", this->CreateString("4")); diff --git a/Source/cmXCodeObject.cxx b/Source/cmXCodeObject.cxx index 262729a..b4ecee9 100644 --- a/Source/cmXCodeObject.cxx +++ b/Source/cmXCodeObject.cxx @@ -20,6 +20,14 @@ cmXCodeObject::cmXCodeObject(PBXType ptype, Type type) str << (void*)this; m_Id = str.str(); cmSystemTools::ReplaceString(m_Id, "0x", ""); + if(m_Id.size() < 24) + { + int diff = 24 - m_Id.size(); + for(int i =0; i < diff; ++i) + { + m_Id += "0"; + } + } m_Type = type; if(m_Type == OBJECT) { |