diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 3f43465b2..42dd42819 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -30,6 +30,7 @@ cmGeneratorTarget::cmGeneratorTarget(cmTarget* t): Target(t) //---------------------------------------------------------------------------- void cmGeneratorTarget::ClassifySources() { + cmsys::RegularExpression header(CM_HEADER_REGEX); bool isObjLib = this->Target->GetType() == cmTarget::OBJECT_LIBRARY; std::vector badObjLib; std::vector const& sources = this->Target->GetSourceFiles(); @@ -72,6 +73,10 @@ void cmGeneratorTarget::ClassifySources() this->IDLSources.push_back(sf); if(isObjLib) { badObjLib.push_back(sf); } } + else if(header.find(sf->GetFullPath().c_str())) + { + this->HeaderSources.push_back(sf); + } else if(this->GlobalGenerator->IgnoreFile(sf->GetExtension().c_str())) { // We only get here if a source file is not an external object diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 56e330507..e7e5edaa3 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -778,8 +778,7 @@ void cmMakefile::SetLocalGenerator(cmLocalGenerator* lg) ("Source Files", "\\.(C|M|c|c\\+\\+|cc|cpp|cxx|f|f90|for|fpp" "|ftn|m|mm|rc|def|r|odl|idl|hpj|bat)$"); - this->AddSourceGroup("Header Files", - "\\.(h|hh|h\\+\\+|hm|hpp|hxx|in|txx|inl)$"); + this->AddSourceGroup("Header Files", CM_HEADER_REGEX); this->AddSourceGroup("CMake Rules", "\\.rule$"); this->AddSourceGroup("Resources", "\\.plist$"); this->AddSourceGroup("Object Files", "\\.(lo|o|obj)$"); diff --git a/Source/cmSourceFile.h b/Source/cmSourceFile.h index 55147e192..ae012747d 100644 --- a/Source/cmSourceFile.h +++ b/Source/cmSourceFile.h @@ -116,4 +116,7 @@ private: std::vector Depends; }; +// TODO: Factor out into platform information modules. +#define CM_HEADER_REGEX "\\.(h|hh|h\\+\\+|hm|hpp|hxx|in|txx|inl)$" + #endif