summaryrefslogtreecommitdiffstats
path: root/Source/cmQtAutomoc.cxx
diff options
context:
space:
mode:
authorAlex Neundorf <neundorf@kde.org>2011-12-02 19:38:14 (GMT)
committerAlex Neundorf <neundorf@kde.org>2011-12-02 19:38:14 (GMT)
commit174bf35fbbcb22636e538323c168ecbc33a7cb39 (patch)
treea186bfc024b3fa51f04d1ff41136db9ec889f5d6 /Source/cmQtAutomoc.cxx
parent8507eaed1659d91709c41d34b351ea6a0585983e (diff)
downloadCMake-174bf35fbbcb22636e538323c168ecbc33a7cb39.zip
CMake-174bf35fbbcb22636e538323c168ecbc33a7cb39.tar.gz
CMake-174bf35fbbcb22636e538323c168ecbc33a7cb39.tar.bz2
automoc: move the code for finding headers into separate function
Alex
Diffstat (limited to 'Source/cmQtAutomoc.cxx')
-rw-r--r--Source/cmQtAutomoc.cxx50
1 files changed, 31 insertions, 19 deletions
diff --git a/Source/cmQtAutomoc.cxx b/Source/cmQtAutomoc.cxx
index bb81dd3..3ff0477 100644
--- a/Source/cmQtAutomoc.cxx
+++ b/Source/cmQtAutomoc.cxx
@@ -469,6 +469,23 @@ bool cmQtAutomoc::RunAutomocQt4()
std::vector<std::string> sourceFiles;
cmSystemTools::ExpandListArgument(this->Sources, sourceFiles);
+ std::list<std::string> headerExtensions;
+ headerExtensions.push_back(".h");
+ headerExtensions.push_back(".hpp");
+ headerExtensions.push_back(".hxx");
+#if defined(_WIN32)
+ // not case sensitive, don't add ".H"
+#elif defined(__APPLE__)
+ // detect case-sensitive filesystem
+ long caseSensitive = pathconf(this->Srcdir.c_str(), _PC_CASE_SENSITIVE);
+ if (caseSensitive == 1)
+ {
+ headerExtensions.push_back(".H");
+ }
+#else
+ headerExtensions.push_back(".H");
+#endif
+
for (std::vector<std::string>::const_iterator it = sourceFiles.begin();
it != sourceFiles.end();
++it)
@@ -478,7 +495,8 @@ bool cmQtAutomoc::RunAutomocQt4()
{
std::cout << "AUTOMOC: Checking " << absFilename << std::endl;
}
- this->ParseCppFile(absFilename, includedMocs, headerFiles);
+ this->ParseCppFile(absFilename, headerExtensions, includedMocs);
+ this->SearchHeadersForCppFile(absFilename, headerExtensions, headerFiles);
}
std::vector<std::string> headerFilesVec;
@@ -559,28 +577,12 @@ bool cmQtAutomoc::RunAutomocQt4()
void cmQtAutomoc::ParseCppFile(const std::string& absFilename,
- std::map<std::string, std::string>& includedMocs,
- std::set<std::string>& absHeaders)
+ const std::list<std::string>& headerExtensions,
+ std::map<std::string, std::string>& includedMocs)
{
cmsys::RegularExpression mocIncludeRegExp(
"[\n][ \t]*#[ \t]*include[ \t]+"
"[\"<](([^ \">]+/)?moc_[^ \">/]+\\.cpp|[^ \">]+\\.moc)[\">]");
- std::list<std::string> headerExtensions;
- headerExtensions.push_back(".h");
- headerExtensions.push_back(".hpp");
- headerExtensions.push_back(".hxx");
-#if defined(_WIN32)
- // not case sensitive, don't add ".H"
-#elif defined(__APPLE__)
- // detect case-sensitive filesystem
- long caseSensitive = pathconf(this->Srcdir.c_str(), _PC_CASE_SENSITIVE);
- if (caseSensitive == 1)
- {
- headerExtensions.push_back(".H");
- }
-#else
- headerExtensions.push_back(".H");
-#endif
const std::string contentsString = this->ReadAll(absFilename);
if (contentsString.empty())
@@ -771,9 +773,19 @@ void cmQtAutomoc::ParseCppFile(const std::string& absFilename,
}
}
+}
+
+
+void cmQtAutomoc::SearchHeadersForCppFile(const std::string& absFilename,
+ const std::list<std::string>& headerExtensions,
+ std::set<std::string>& absHeaders)
+{
// search for header files and private header files we may need to moc:
const std::string basename =
cmsys::SystemTools::GetFilenameWithoutLastExtension(absFilename);
+ const std::string absPath = cmsys::SystemTools::GetFilenamePath(
+ cmsys::SystemTools::GetRealPath(absFilename.c_str())) + '/';
+
for(std::list<std::string>::const_iterator ext = headerExtensions.begin();
ext != headerExtensions.end();
++ext)