diff options
author | Bill Hoffman <bill.hoffman@kitware.com> | 2005-02-16 21:35:32 (GMT) |
---|---|---|
committer | Bill Hoffman <bill.hoffman@kitware.com> | 2005-02-16 21:35:32 (GMT) |
commit | cb73410ccb8d2c05085b8fc5551215214bf12edd (patch) | |
tree | 8d9e562959db6e434bf9288716b5c3f05a4f7112 /Source | |
parent | ae63ae6a6e48d2c502c7318dce66398183e6dbe4 (diff) | |
download | CMake-cb73410ccb8d2c05085b8fc5551215214bf12edd.zip CMake-cb73410ccb8d2c05085b8fc5551215214bf12edd.tar.gz CMake-cb73410ccb8d2c05085b8fc5551215214bf12edd.tar.bz2 |
ENH: more tests are passing
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmGlobalGenerator.cxx | 10 | ||||
-rw-r--r-- | Source/cmGlobalXCodeGenerator.cxx | 81 | ||||
-rw-r--r-- | Source/cmGlobalXCodeGenerator.h | 1 | ||||
-rw-r--r-- | Source/cmMakefile.cxx | 14 | ||||
-rw-r--r-- | Source/cmMakefile.h | 1 |
5 files changed, 97 insertions, 10 deletions
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 17cad1a..2f740d1 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -799,17 +799,15 @@ void cmGlobalGenerator::FillProjectMap() } + cmTarget* cmGlobalGenerator::FindTarget(const char* name) { for(unsigned int i = 0; i < m_LocalGenerators.size(); ++i) { - cmTargets& tgts = m_LocalGenerators[i]->GetMakefile()->GetTargets(); - for(cmTargets::iterator l = tgts.begin(); l != tgts.end(); l++) + cmTarget* ret = m_LocalGenerators[i]->GetMakefile()->FindTarget(name); + if(ret) { - if(l->first == name) - { - return &l->second; - } + return ret; } } return 0; diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index b8086a5..714f441 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -187,9 +187,33 @@ cmLocalGenerator *cmGlobalXCodeGenerator::CreateLocalGenerator() void cmGlobalXCodeGenerator::Generate() { this->cmGlobalGenerator::Generate(); + std::vector<std::string> srcs; std::map<cmStdString, std::vector<cmLocalGenerator*> >::iterator it; for(it = m_ProjectMap.begin(); it!= m_ProjectMap.end(); ++it) { + // add a ALL_BUILD target to the first makefile of each project + it->second[0]->GetMakefile()-> + AddUtilityCommand("ALL_BUILD", "echo", + "\"Build all projects\"",false,srcs); + cmTarget* allbuild = + it->second[0]->GetMakefile()->FindTarget("ALL_BUILD"); + // now make the allbuild depend on all the non-utility targets + // in the project + for(std::vector<cmLocalGenerator*>::iterator i = it->second.begin(); + i != it->second.end(); ++i) + { + cmLocalGenerator* lg = *i; + cmTargets& tgts = lg->GetMakefile()->GetTargets(); + for(cmTargets::iterator l = tgts.begin(); l != tgts.end(); l++) + { + cmTarget& target = l->second; + if(target.GetType() < cmTarget::UTILITY) + { + allbuild->AddUtility(target.GetName()); + } + } + } + // now create the project this->OutputXCodeProject(it->second[0], it->second); } } @@ -294,6 +318,15 @@ cmGlobalXCodeGenerator::CreateXCodeTargets(cmLocalGenerator* gen, for(cmTargets::iterator l = tgts.begin(); l != tgts.end(); l++) { cmTarget& cmtarget = l->second; + // make sure ALL_BUILD is only done once + if(l->first == "ALL_BUILD") + { + if(m_DoneAllBuild) + { + continue; + } + m_DoneAllBuild = true; + } if(cmtarget.GetType() == cmTarget::UTILITY || cmtarget.GetType() == cmTarget::INSTALL_FILES || cmtarget.GetType() == cmTarget::INSTALL_PROGRAMS) @@ -646,8 +679,13 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target, this->CreateString (m_LibraryOutputPath.c_str())); } + + buildSettings->AddAttribute("EXECUTABLE_PREFIX", + this->CreateString("lib")); + buildSettings->AddAttribute("EXECUTABLE_EXTENSION", + this->CreateString("so")); buildSettings->AddAttribute("LIBRARY_STYLE", - this->CreateString("DYNAMIC")); + this->CreateString("BUNDLE")); productName += ".so"; std::string t = "lib"; t += productName; @@ -745,7 +783,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target, buildSettings->AddAttribute("GCC_OPTIMIZATION_LEVEL", this->CreateString("0")); buildSettings->AddAttribute("INSTALL_PATH", - this->CreateString("/usr/local/bin")); + this->CreateString("")); buildSettings->AddAttribute("OPTIMIZATION_CFLAGS", this->CreateString("")); buildSettings->AddAttribute("OTHER_CFLAGS", @@ -760,8 +798,14 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target, this->CreateString( "-Wmost -Wno-four-char-constants" " -Wno-unknown-pragmas")); + std::string pname; + if(target.GetType() == cmTarget::SHARED_LIBRARY) + { + pname = "lib"; + } + pname += target.GetName(); buildSettings->AddAttribute("PRODUCT_NAME", - this->CreateString(target.GetName())); + this->CreateString(pname.c_str())); } cmXCodeObject* @@ -932,6 +976,33 @@ void cmGlobalXCodeGenerator::AddLinkLibrary(cmXCodeObject* target, std::string libPath = library; cmXCodeObject* fileRef = this->CreateObject(cmXCodeObject::PBXFileReference); + // add the library path to the search path for the target + cmXCodeObject* bset = target->GetObject("buildSettings"); + if(bset) + { + std::string dir; + std::string file; + cmSystemTools::SplitProgramPath(library, dir, file); + cmXCodeObject* spath = bset->GetObject("LIBRARY_SEARCH_PATHS"); + if(spath) + { + std::string libs = spath->GetString(); + // remove double quotes + libs = libs.substr(1, libs.size()-2); + libs += " "; + libs += + m_CurrentLocalGenerator->ConvertToOutputForExisting(dir.c_str()); + spath->SetString(libs.c_str()); + } + else + { + std::string libs = + m_CurrentLocalGenerator->ConvertToOutputForExisting(dir.c_str()); + bset->AddAttribute("LIBRARY_SEARCH_PATHS", + this->CreateString(libs.c_str())); + } + } + if(libPath[libPath.size()-1] == 'a') { fileRef->AddAttribute("lastKnownFileType", @@ -973,9 +1044,10 @@ void cmGlobalXCodeGenerator::AddLinkLibrary(cmXCodeObject* target, cmsys::RegularExpression reg("^([ \t]*\\-[lWRB])|([ \t]*\\-framework)|(\\${)|([ \t]*\\-pthread)|([ \t]*`)"); // if the library is not already in the form required by the compiler // add a -l infront of the name + link += " "; if(!reg.find(library)) { - link += " -l"; + link += "-l"; } link += library; ldflags->SetString(link.c_str()); @@ -1110,6 +1182,7 @@ void cmGlobalXCodeGenerator::CreateXCodeObjects(cmLocalGenerator* , m_RootObject->AddAttribute("hasScannedForEncodings", this->CreateString("0")); std::vector<cmXCodeObject*> targets; + m_DoneAllBuild = false; for(std::vector<cmLocalGenerator*>::iterator i = generators.begin(); i != generators.end(); ++i) { diff --git a/Source/cmGlobalXCodeGenerator.h b/Source/cmGlobalXCodeGenerator.h index ccf627a..a8f73d0 100644 --- a/Source/cmGlobalXCodeGenerator.h +++ b/Source/cmGlobalXCodeGenerator.h @@ -124,6 +124,7 @@ private: std::string m_LibraryOutputPath; std::string m_ExecutableOutputPath; cmLocalGenerator* m_CurrentLocalGenerator; + bool m_DoneAllBuild; }; #endif diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index c6c8541..cd3b4de 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -2538,3 +2538,17 @@ bool cmMakefile::GetPropertyAsBool(const char* prop) const } return false; } + + +cmTarget* cmMakefile::FindTarget(const char* name) +{ + cmTargets& tgts = this->GetTargets(); + for(cmTargets::iterator l = tgts.begin(); l != tgts.end(); l++) + { + if(l->first == name) + { + return &l->second; + } + } + return 0; +} diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 6855819..4f99b5c 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -433,6 +433,7 @@ public: cmTargets &GetTargets() { return m_Targets; } const cmTargets &GetTargets() const { return m_Targets; } + cmTarget* FindTarget(const char* name); /** * Get a list of the build subdirectories. */ |