ENH: Adding .hh file as a C++ header file extension. Remove duplicate code from implementation of unique object name computation for VS generators. This addresses bug#3565.
This commit is contained in:
parent
c75fb61f3c
commit
8dda3a2f6e
@ -30,6 +30,14 @@ cmLocalVisualStudioGenerator::~cmLocalVisualStudioGenerator()
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
bool cmLocalVisualStudioGenerator::SourceFileCompiles(const cmSourceFile* sf)
|
||||||
|
{
|
||||||
|
return (!sf->GetCustomCommand() &&
|
||||||
|
!sf->GetPropertyAsBool("HEADER_FILE_ONLY") &&
|
||||||
|
!sf->GetPropertyAsBool("EXTERNAL_OBJECT"));
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
void cmLocalVisualStudioGenerator::ComputeObjectNameRequirements
|
void cmLocalVisualStudioGenerator::ComputeObjectNameRequirements
|
||||||
(std::vector<cmSourceGroup> const& sourceGroups)
|
(std::vector<cmSourceGroup> const& sourceGroups)
|
||||||
@ -46,14 +54,12 @@ void cmLocalVisualStudioGenerator::ComputeObjectNameRequirements
|
|||||||
for(std::vector<const cmSourceFile*>::const_iterator s = srcs.begin();
|
for(std::vector<const cmSourceFile*>::const_iterator s = srcs.begin();
|
||||||
s != srcs.end(); ++s)
|
s != srcs.end(); ++s)
|
||||||
{
|
{
|
||||||
const cmSourceFile& sf = *(*s);
|
const cmSourceFile* sf = *s;
|
||||||
if(!sf.GetCustomCommand() &&
|
if(this->SourceFileCompiles(sf))
|
||||||
!sf.GetPropertyAsBool("HEADER_FILE_ONLY") &&
|
|
||||||
!sf.GetPropertyAsBool("EXTERNAL_OBJECT"))
|
|
||||||
{
|
{
|
||||||
std::string objectName =
|
std::string objectName =
|
||||||
cmSystemTools::GetFilenameWithoutLastExtension(
|
cmSystemTools::GetFilenameWithoutLastExtension(
|
||||||
sf.GetFullPath().c_str());
|
sf->GetFullPath().c_str());
|
||||||
objectName += ".obj";
|
objectName += ".obj";
|
||||||
objectNameCounts[objectName] += 1;
|
objectNameCounts[objectName] += 1;
|
||||||
}
|
}
|
||||||
@ -70,9 +76,7 @@ void cmLocalVisualStudioGenerator::ComputeObjectNameRequirements
|
|||||||
s != srcs.end(); ++s)
|
s != srcs.end(); ++s)
|
||||||
{
|
{
|
||||||
const cmSourceFile* sf = *s;
|
const cmSourceFile* sf = *s;
|
||||||
if(!sf->GetCustomCommand() &&
|
if(this->SourceFileCompiles(sf))
|
||||||
!sf->GetPropertyAsBool("HEADER_FILE_ONLY") &&
|
|
||||||
!sf->GetPropertyAsBool("EXTERNAL_OBJECT"))
|
|
||||||
{
|
{
|
||||||
std::string objectName =
|
std::string objectName =
|
||||||
cmSystemTools::GetFilenameWithoutLastExtension(
|
cmSystemTools::GetFilenameWithoutLastExtension(
|
||||||
|
@ -37,6 +37,7 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
// Safe object file name generation.
|
// Safe object file name generation.
|
||||||
void ComputeObjectNameRequirements(std::vector<cmSourceGroup> const&);
|
void ComputeObjectNameRequirements(std::vector<cmSourceGroup> const&);
|
||||||
|
bool SourceFileCompiles(const cmSourceFile* sf);
|
||||||
std::set<const cmSourceFile*> NeedObjectName;
|
std::set<const cmSourceFile*> NeedObjectName;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -63,6 +63,7 @@ cmMakefile::cmMakefile()
|
|||||||
this->SourceFileExtensions.push_back( "mm" );
|
this->SourceFileExtensions.push_back( "mm" );
|
||||||
|
|
||||||
this->HeaderFileExtensions.push_back( "h" );
|
this->HeaderFileExtensions.push_back( "h" );
|
||||||
|
this->HeaderFileExtensions.push_back( "hh" );
|
||||||
this->HeaderFileExtensions.push_back( "h++" );
|
this->HeaderFileExtensions.push_back( "h++" );
|
||||||
this->HeaderFileExtensions.push_back( "hm" );
|
this->HeaderFileExtensions.push_back( "hm" );
|
||||||
this->HeaderFileExtensions.push_back( "hpp" );
|
this->HeaderFileExtensions.push_back( "hpp" );
|
||||||
@ -79,7 +80,7 @@ cmMakefile::cmMakefile()
|
|||||||
("Source Files",
|
("Source Files",
|
||||||
"\\.(C|M|c|c\\+\\+|cc|cpp|cxx|m|mm|rc|def|r|odl|idl|hpj|bat)$");
|
"\\.(C|M|c|c\\+\\+|cc|cpp|cxx|m|mm|rc|def|r|odl|idl|hpj|bat)$");
|
||||||
this->AddSourceGroup("Header Files",
|
this->AddSourceGroup("Header Files",
|
||||||
"\\.(h|h\\+\\+|hm|hpp|hxx|in|txx|inl)$");
|
"\\.(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$");
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user