From 8dda3a2f6e4c9832642f2f6c102897cfca0670b3 Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 1 Aug 2006 10:48:40 -0400 Subject: 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. --- Source/cmLocalVisualStudioGenerator.cxx | 20 ++++++++++++-------- Source/cmLocalVisualStudioGenerator.h | 1 + Source/cmMakefile.cxx | 3 ++- 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/Source/cmLocalVisualStudioGenerator.cxx b/Source/cmLocalVisualStudioGenerator.cxx index b4ab9e2..5ff0966 100644 --- a/Source/cmLocalVisualStudioGenerator.cxx +++ b/Source/cmLocalVisualStudioGenerator.cxx @@ -31,6 +31,14 @@ cmLocalVisualStudioGenerator::~cmLocalVisualStudioGenerator() } //---------------------------------------------------------------------------- +bool cmLocalVisualStudioGenerator::SourceFileCompiles(const cmSourceFile* sf) +{ + return (!sf->GetCustomCommand() && + !sf->GetPropertyAsBool("HEADER_FILE_ONLY") && + !sf->GetPropertyAsBool("EXTERNAL_OBJECT")); +} + +//---------------------------------------------------------------------------- void cmLocalVisualStudioGenerator::ComputeObjectNameRequirements (std::vector const& sourceGroups) { @@ -46,14 +54,12 @@ void cmLocalVisualStudioGenerator::ComputeObjectNameRequirements for(std::vector::const_iterator s = srcs.begin(); s != srcs.end(); ++s) { - const cmSourceFile& sf = *(*s); - if(!sf.GetCustomCommand() && - !sf.GetPropertyAsBool("HEADER_FILE_ONLY") && - !sf.GetPropertyAsBool("EXTERNAL_OBJECT")) + const cmSourceFile* sf = *s; + if(this->SourceFileCompiles(sf)) { std::string objectName = cmSystemTools::GetFilenameWithoutLastExtension( - sf.GetFullPath().c_str()); + sf->GetFullPath().c_str()); objectName += ".obj"; objectNameCounts[objectName] += 1; } @@ -70,9 +76,7 @@ void cmLocalVisualStudioGenerator::ComputeObjectNameRequirements s != srcs.end(); ++s) { const cmSourceFile* sf = *s; - if(!sf->GetCustomCommand() && - !sf->GetPropertyAsBool("HEADER_FILE_ONLY") && - !sf->GetPropertyAsBool("EXTERNAL_OBJECT")) + if(this->SourceFileCompiles(sf)) { std::string objectName = cmSystemTools::GetFilenameWithoutLastExtension( diff --git a/Source/cmLocalVisualStudioGenerator.h b/Source/cmLocalVisualStudioGenerator.h index 6fe0034..ac6baf9 100644 --- a/Source/cmLocalVisualStudioGenerator.h +++ b/Source/cmLocalVisualStudioGenerator.h @@ -37,6 +37,7 @@ public: protected: // Safe object file name generation. void ComputeObjectNameRequirements(std::vector const&); + bool SourceFileCompiles(const cmSourceFile* sf); std::set NeedObjectName; }; diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 871a81b..c45f789 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -63,6 +63,7 @@ cmMakefile::cmMakefile() this->SourceFileExtensions.push_back( "mm" ); this->HeaderFileExtensions.push_back( "h" ); + this->HeaderFileExtensions.push_back( "hh" ); this->HeaderFileExtensions.push_back( "h++" ); this->HeaderFileExtensions.push_back( "hm" ); this->HeaderFileExtensions.push_back( "hpp" ); @@ -79,7 +80,7 @@ cmMakefile::cmMakefile() ("Source Files", "\\.(C|M|c|c\\+\\+|cc|cpp|cxx|m|mm|rc|def|r|odl|idl|hpj|bat)$"); 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("Resources", "\\.plist$"); #endif -- cgit v0.12