Classify known header file extensions as headers
Commit 328c0f65
(Simplify cmVisualStudio10TargetGenerator source
classification, 2012-03-19) introduced the first use of source
classification from cmGeneratorTarget (which originated as Makefile
generator logic) in a Visual Studio generator for handling of header
files. Fix classification of header files to match known header
extensions instead of only the HEADER_FILE_ONLY property. Make it
consistent with the "Header Files" source group.
This commit is contained in:
parent
1c489923d5
commit
9a2c60eb83
|
@ -30,6 +30,7 @@ cmGeneratorTarget::cmGeneratorTarget(cmTarget* t): Target(t)
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
void cmGeneratorTarget::ClassifySources()
|
void cmGeneratorTarget::ClassifySources()
|
||||||
{
|
{
|
||||||
|
cmsys::RegularExpression header(CM_HEADER_REGEX);
|
||||||
bool isObjLib = this->Target->GetType() == cmTarget::OBJECT_LIBRARY;
|
bool isObjLib = this->Target->GetType() == cmTarget::OBJECT_LIBRARY;
|
||||||
std::vector<cmSourceFile*> badObjLib;
|
std::vector<cmSourceFile*> badObjLib;
|
||||||
std::vector<cmSourceFile*> const& sources = this->Target->GetSourceFiles();
|
std::vector<cmSourceFile*> const& sources = this->Target->GetSourceFiles();
|
||||||
|
@ -72,6 +73,10 @@ void cmGeneratorTarget::ClassifySources()
|
||||||
this->IDLSources.push_back(sf);
|
this->IDLSources.push_back(sf);
|
||||||
if(isObjLib) { badObjLib.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()))
|
else if(this->GlobalGenerator->IgnoreFile(sf->GetExtension().c_str()))
|
||||||
{
|
{
|
||||||
// We only get here if a source file is not an external object
|
// We only get here if a source file is not an external object
|
||||||
|
|
|
@ -778,8 +778,7 @@ void cmMakefile::SetLocalGenerator(cmLocalGenerator* lg)
|
||||||
("Source Files",
|
("Source Files",
|
||||||
"\\.(C|M|c|c\\+\\+|cc|cpp|cxx|f|f90|for|fpp"
|
"\\.(C|M|c|c\\+\\+|cc|cpp|cxx|f|f90|for|fpp"
|
||||||
"|ftn|m|mm|rc|def|r|odl|idl|hpj|bat)$");
|
"|ftn|m|mm|rc|def|r|odl|idl|hpj|bat)$");
|
||||||
this->AddSourceGroup("Header Files",
|
this->AddSourceGroup("Header Files", CM_HEADER_REGEX);
|
||||||
"\\.(h|hh|h\\+\\+|hm|hpp|hxx|in|txx|inl)$");
|
|
||||||
this->AddSourceGroup("CMake Rules", "\\.rule$");
|
this->AddSourceGroup("CMake Rules", "\\.rule$");
|
||||||
this->AddSourceGroup("Resources", "\\.plist$");
|
this->AddSourceGroup("Resources", "\\.plist$");
|
||||||
this->AddSourceGroup("Object Files", "\\.(lo|o|obj)$");
|
this->AddSourceGroup("Object Files", "\\.(lo|o|obj)$");
|
||||||
|
|
|
@ -116,4 +116,7 @@ private:
|
||||||
std::vector<std::string> Depends;
|
std::vector<std::string> Depends;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// TODO: Factor out into platform information modules.
|
||||||
|
#define CM_HEADER_REGEX "\\.(h|hh|h\\+\\+|hm|hpp|hxx|in|txx|inl)$"
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue