diff options
author | Bill Hoffman <bill.hoffman@kitware.com> | 2007-05-24 21:06:32 (GMT) |
---|---|---|
committer | Bill Hoffman <bill.hoffman@kitware.com> | 2007-05-24 21:06:32 (GMT) |
commit | d0f12061c32a2afe14c5b910bf6f86156552e3d3 (patch) | |
tree | 9dae7a4a1fedbcf2a40a7d8f4ceb38bf924ad597 | |
parent | c9aecb91cc326a8e42a78c11eb2b32ffb2518dc0 (diff) | |
download | CMake-d0f12061c32a2afe14c5b910bf6f86156552e3d3.zip CMake-d0f12061c32a2afe14c5b910bf6f86156552e3d3.tar.gz CMake-d0f12061c32a2afe14c5b910bf6f86156552e3d3.tar.bz2 |
ENH: add copy header stuff
-rw-r--r-- | Source/cmGlobalXCodeGenerator.cxx | 69 | ||||
-rw-r--r-- | Source/cmGlobalXCodeGenerator.h | 3 |
2 files changed, 70 insertions, 2 deletions
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index a796bae..e6e431a 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -729,6 +729,51 @@ cmGlobalXCodeGenerator::CreateXCodeTargets(cmLocalGenerator* gen, buildFiles->AddObject(xsf); } } + if(cmtarget.GetPropertyAsBool("FRAMEWORK")) + { + this->AddFrameworkPhases(&cmtarget, buildPhases); + } + } +} + +//---------------------------------------------------------------------------- +void cmGlobalXCodeGenerator::AddFrameworkPhases(cmTarget* target, + cmXCodeObject* buildPhases) +{ + const char* headers = target->GetProperty("FRAMEWORK_PUBLIC_HEADERS"); + if(!headers) + { + return; + } + + cmXCodeObject* copyHeaders = + this->CreateObject(cmXCodeObject::PBXCopyFilesBuildPhase); + copyHeaders->SetComment("Copy files"); + copyHeaders->AddAttribute("buildActionMask", + this->CreateString("2147483647")); + copyHeaders->AddAttribute("dstSubfolderSpec", + this->CreateString("6")); + copyHeaders->AddAttribute("dstPath", + this->CreateString("Headers")); + buildPhases->AddObject(copyHeaders); + cmXCodeObject* headersToCopy = + this->CreateObject(cmXCodeObject::OBJECT_LIST); + copyHeaders->AddAttribute("files", headersToCopy); + std::vector<std::string> headersVec; + cmSystemTools::ExpandListArgument(headers, + headersVec); + cmCustomCommandLines commandLines; + std::vector<std::string> depends; + for(std::vector<std::string>::iterator i = headersVec.begin(); + i != headersVec.end(); ++i) + { + cmCustomCommandLine line; + cmSourceFile* sf = this->CurrentMakefile->GetOrCreateSource(i->c_str()); + cmXCodeObject* xsf = + this->CreateXCodeSourceFile(this->CurrentLocalGenerator, + sf, *target); + std::cerr << "copy header " << sf->GetFullPath() << "\n"; + headersToCopy->AddObject(xsf); } } @@ -2008,8 +2053,28 @@ void cmGlobalXCodeGenerator::CreateGroups(cmLocalGenerator* root, cmtarget.GetSourceFiles().push_back (this->CurrentMakefile->AddSource(file)); } - - std::vector<cmSourceFile*> & classes = cmtarget.GetSourceFiles(); + std::vector<cmSourceFile*> classes = cmtarget.GetSourceFiles(); + // add framework copy headers + if(cmtarget.GetPropertyAsBool("FRAMEWORK")) + { + const char* headers = cmtarget.GetProperty("FRAMEWORK_PUBLIC_HEADERS"); + if(!headers) + { + return; + } + std::vector<std::string> headersVec; + cmSystemTools::ExpandListArgument(headers, + headersVec); + cmCustomCommandLines commandLines; + std::vector<std::string> depends; + for(std::vector<std::string>::iterator i = headersVec.begin(); + i != headersVec.end(); ++i) + { + cmSourceFile* sf + = this->CurrentMakefile->GetOrCreateSource(i->c_str()); + classes.push_back(sf); + } + } for(std::vector<cmSourceFile*>::const_iterator s = classes.begin(); s != classes.end(); s++) { diff --git a/Source/cmGlobalXCodeGenerator.h b/Source/cmGlobalXCodeGenerator.h index 5c8caa5..9bfc62d 100644 --- a/Source/cmGlobalXCodeGenerator.h +++ b/Source/cmGlobalXCodeGenerator.h @@ -65,6 +65,9 @@ public: const char* config, bool ignoreErrors, bool fast); + + // add extra build phases for a framework target + void AddFrameworkPhases(cmTarget*, cmXCodeObject* buildPhases); /** * Generate the all required files for building this project/tree. This |