diff --git a/Source/cmCPluginAPI.cxx b/Source/cmCPluginAPI.cxx index 04257cb3b..d94cf3ea9 100644 --- a/Source/cmCPluginAPI.cxx +++ b/Source/cmCPluginAPI.cxx @@ -706,10 +706,6 @@ void CCONV cmSourceFileSetName(void *arg, const char* name, const char* dir, headerExts.push_back(headerExtensions[i]); } - // Implement the old SetName method code here. - sf->Properties.SetProperty("HEADER_FILE_ONLY", "1", - cmProperty::SOURCE_FILE); - // Save the original name given. sf->SourceName = name; @@ -742,13 +738,6 @@ void CCONV cmSourceFileSetName(void *arg, const char* name, const char* dir, } } - // See if the file is a header file - if(std::find( headerExts.begin(), headerExts.end(), - sf->SourceExtension ) == headerExts.end()) - { - sf->Properties.SetProperty("HEADER_FILE_ONLY", "0", - cmProperty::SOURCE_FILE); - } sf->FullPath = hname; return; } @@ -763,8 +752,6 @@ void CCONV cmSourceFileSetName(void *arg, const char* name, const char* dir, if(cmSystemTools::FileExists(hname.c_str())) { sf->SourceExtension = *ext; - sf->Properties.SetProperty("HEADER_FILE_ONLY", "0", - cmProperty::SOURCE_FILE); sf->FullPath = hname; return; } @@ -814,9 +801,11 @@ void CCONV cmSourceFileSetName2(void *arg, const char* name, const char* dir, } // Implement the old SetName method code here. - sf->Properties.SetProperty("HEADER_FILE_ONLY", - headerFileOnly? "1" : "0", - cmProperty::SOURCE_FILE); + if(headerFileOnly) + { + sf->Properties.SetProperty("HEADER_FILE_ONLY", "1", + cmProperty::SOURCE_FILE); + } sf->SourceName = name; std::string fname = sf->SourceName; if(ext && strlen(ext)) diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index db1d78f59..3fd14a921 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -732,7 +732,7 @@ cmGlobalXCodeGenerator::CreateXCodeTargets(cmLocalGenerator* gen, { externalObjFiles.push_back(xsf); } - else if((*i)->GetPropertyAsBool("HEADER_FILE_ONLY") || + else if(this->IsHeaderFile(*i) || (tsFlags.Type == cmTarget::SourceFileTypePrivateHeader) || (tsFlags.Type == cmTarget::SourceFileTypePublicHeader)) { @@ -742,7 +742,7 @@ cmGlobalXCodeGenerator::CreateXCodeTargets(cmLocalGenerator* gen, { resourceFiles.push_back(xsf); } - else + else if(!(*i)->GetPropertyAsBool("HEADER_FILE_ONLY")) { // Include this file in the build if it has a known language // and has not been listed as an ignored extension for this @@ -911,6 +911,15 @@ cmGlobalXCodeGenerator::CreateXCodeTargets(cmLocalGenerator* gen, } } +//---------------------------------------------------------------------------- +bool cmGlobalXCodeGenerator::IsHeaderFile(cmSourceFile* sf) +{ + const std::vector& hdrExts = + this->CurrentMakefile->GetHeaderExtensions(); + return (std::find(hdrExts.begin(), hdrExts.end(), sf->GetExtension()) != + hdrExts.end()); +} + //---------------------------------------------------------------------------- cmXCodeObject* cmGlobalXCodeGenerator::CreateBuildPhase(const char* name, diff --git a/Source/cmGlobalXCodeGenerator.h b/Source/cmGlobalXCodeGenerator.h index 6e85a6987..7a7bb0089 100644 --- a/Source/cmGlobalXCodeGenerator.h +++ b/Source/cmGlobalXCodeGenerator.h @@ -159,6 +159,7 @@ private: cmTarget& cmtarget); void CreateXCodeTargets(cmLocalGenerator* gen, std::vector&); + bool IsHeaderFile(cmSourceFile*); void AddDependTarget(cmXCodeObject* target, cmXCodeObject* dependTarget); void CreateXCodeDependHackTarget(std::vector& targets); diff --git a/Source/cmSourceFile.cxx b/Source/cmSourceFile.cxx index 6fe10245b..8603d984a 100644 --- a/Source/cmSourceFile.cxx +++ b/Source/cmSourceFile.cxx @@ -246,25 +246,6 @@ void cmSourceFile::CheckExtension() this->SetProperty("EXTERNAL_OBJECT", "1"); } - // Look for header files. - cmMakefile* mf = this->Location.GetMakefile(); - const std::vector& hdrExts = mf->GetHeaderExtensions(); - if(std::find(hdrExts.begin(), hdrExts.end(), this->Extension) == - hdrExts.end()) - { - // This is not a known header file extension. Mark it as not a - // header unless the user has already explicitly set the property. - if(!this->GetProperty("HEADER_FILE_ONLY")) - { - this->SetProperty("HEADER_FILE_ONLY", "0"); - } - } - else - { - // This is a known header file extension. The source cannot be compiled. - this->SetProperty("HEADER_FILE_ONLY", "1"); - } - // Try to identify the source file language from the extension. if(this->Language.empty()) {