diff options
author | Brad King <brad.king@kitware.com> | 2013-10-22 13:08:01 (GMT) |
---|---|---|
committer | CMake Topic Stage <kwrobot@kitware.com> | 2013-10-22 13:08:01 (GMT) |
commit | c9518497997845306b2d1127fbd7acf4e6081fe8 (patch) | |
tree | e078108a7da9793775d0ce4cec9f533efd9d0edd /Source | |
parent | 5db203d6be8e1132429dd364c0fe8c34eb1835ba (diff) | |
parent | e5ec8ad47dc07623b6318bb413e01cc921cf66c4 (diff) | |
download | CMake-c9518497997845306b2d1127fbd7acf4e6081fe8.zip CMake-c9518497997845306b2d1127fbd7acf4e6081fe8.tar.gz CMake-c9518497997845306b2d1127fbd7acf4e6081fe8.tar.bz2 |
Merge topic 'xcode-folder-types'
e5ec8ad Xcode: Generate 'folder' source type for directories (#14498)
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmGlobalXCodeGenerator.cxx | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index c8b6832..13ed143 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -876,10 +876,20 @@ cmGlobalXCodeGenerator::CreateXCodeFileReferenceFromPath( ext = realExt.substr(1); } - std::string sourcecode = GetSourcecodeValueFromFileExtension(ext, lang); - - fileRef->AddAttribute("explicitFileType", - this->CreateString(sourcecode.c_str())); + // If fullpath references a directory, then we need to specify + // lastKnownFileType as folder in order for Xcode to be able to open the + // contents of the folder (Xcode 4.6 does not like explicitFileType=folder). + if(cmSystemTools::FileIsDirectory(fullpath.c_str())) + { + fileRef->AddAttribute("lastKnownFileType", + this->CreateString("folder")); + } + else + { + std::string sourcecode = GetSourcecodeValueFromFileExtension(ext, lang); + fileRef->AddAttribute("explicitFileType", + this->CreateString(sourcecode.c_str())); + } // Store the file path relative to the top of the source tree. std::string path = this->RelativeToSource(fullpath.c_str()); @@ -1009,7 +1019,8 @@ cmGlobalXCodeGenerator::CreateXCodeTargets(cmLocalGenerator* gen, cmTarget::SourceFileFlags tsFlags = cmtarget.GetTargetSourceFileFlags(*i); - if(strcmp(filetype->GetString(), "compiled.mach-o.objfile") == 0) + if(filetype && + strcmp(filetype->GetString(), "compiled.mach-o.objfile") == 0) { externalObjFiles.push_back(xsf); } |