소스 검색

Xcode: Generate per-target file references (#15111)

Xcode requires a separate PBXFileReference for each target source group
that references a source file.  Xcode 6 now diagnoses re-use of the same
PBXFileReference from multiple source groups.  Add the referencing
target name to our internal map key so we use a per-target reference.
Brad King 11 년 전
부모
커밋
e7114226e6
1개의 변경된 파일4개의 추가작업 그리고 6개의 파일을 삭제
  1. 4 6
      Source/cmGlobalXCodeGenerator.cxx

+ 4 - 6
Source/cmGlobalXCodeGenerator.cxx

@@ -837,16 +837,14 @@ cmGlobalXCodeGenerator::CreateXCodeFileReferenceFromPath(
   cmTarget& cmtarget,
   const std::string &lang)
 {
-  std::string fname = fullpath;
-  cmXCodeObject* fileRef = this->FileRefs[fname];
+  cmStdString key = GetGroupMapKeyFromPath(cmtarget, fullpath);
+  cmXCodeObject* fileRef = this->FileRefs[key];
   if(!fileRef)
     {
     fileRef = this->CreateObject(cmXCodeObject::PBXFileReference);
-    std::string comment = fname;
-    fileRef->SetComment(fname.c_str());
-    this->FileRefs[fname] = fileRef;
+    fileRef->SetComment(fullpath.c_str());
+    this->FileRefs[key] = fileRef;
     }
-  cmStdString key = GetGroupMapKeyFromPath(cmtarget, fullpath);
   cmXCodeObject* group = this->GroupMap[key];
   cmXCodeObject* children = group->GetObject("children");
   if (!children->HasObject(fileRef))