diff options
author | Sebastian Holtermann <sebholt@xwmw.org> | 2017-02-23 18:44:29 (GMT) |
---|---|---|
committer | Sebastian Holtermann <sebholt@xwmw.org> | 2017-03-01 14:30:28 (GMT) |
commit | db431ecfe33dbfa9eb43e4edd72ebc35b2c7c563 (patch) | |
tree | a6c96e5517ae137c7a37e1a8eff1d1ba4c97af25 /Source/cmQtAutoGenerators.cxx | |
parent | ebc28c156ee56c878990c53cbd62779249b139bb (diff) | |
download | CMake-db431ecfe33dbfa9eb43e4edd72ebc35b2c7c563.zip CMake-db431ecfe33dbfa9eb43e4edd72ebc35b2c7c563.tar.gz CMake-db431ecfe33dbfa9eb43e4edd72ebc35b2c7c563.tar.bz2 |
Autogen: Merge FindInIncludeDirectories into FindIncludeFile
Diffstat (limited to 'Source/cmQtAutoGenerators.cxx')
-rw-r--r-- | Source/cmQtAutoGenerators.cxx | 46 |
1 files changed, 20 insertions, 26 deletions
diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx index e7e456a..902e872 100644 --- a/Source/cmQtAutoGenerators.cxx +++ b/Source/cmQtAutoGenerators.cxx @@ -733,9 +733,8 @@ void cmQtAutoGenerators::MocFindDepends( const std::string match = filter.regExp.match(1); if (!match.empty()) { // Find the dependency file - const std::string incFile = - this->FindIncludedFile(absFilename, match); - if (!incFile.empty()) { + std::string incFile; + if (this->FindIncludedFile(incFile, absFilename, match)) { mocDepends[absFilename].insert(incFile); if (this->Verbose) { this->LogInfo("AutoMoc: Found dependency:\n " + @@ -1780,40 +1779,35 @@ std::string cmQtAutoGenerators::FindMocHeader(const std::string& basePath, return header; } -std::string cmQtAutoGenerators::FindIncludedFile( - const std::string& sourceFile, const std::string& includeString) const +bool cmQtAutoGenerators::FindIncludedFile( + std::string& absFile, const std::string& sourceFile, + const std::string& includeString) const { + bool success = false; // Search in vicinity of the source { std::string testPath = cmSystemTools::GetFilenamePath(sourceFile); testPath += '/'; testPath += includeString; if (cmsys::SystemTools::FileExists(testPath.c_str())) { - return cmsys::SystemTools::GetRealPath(testPath); + absFile = cmsys::SystemTools::GetRealPath(testPath); + success = true; } } - // Search globally - return FindInIncludeDirectories(includeString); -} - -/** - * @brief Tries to find a file in the include directories - * @return True on success - */ -std::string cmQtAutoGenerators::FindInIncludeDirectories( - const std::string& includeString) const -{ - std::string res; - for (std::vector<std::string>::const_iterator iit = - this->MocIncludePaths.begin(); - iit != this->MocIncludePaths.end(); ++iit) { - const std::string fullPath = ((*iit) + '/' + includeString); - if (cmsys::SystemTools::FileExists(fullPath.c_str())) { - res = cmsys::SystemTools::GetRealPath(fullPath); - break; + // Search in include directories + if (!success) { + for (std::vector<std::string>::const_iterator iit = + this->MocIncludePaths.begin(); + iit != this->MocIncludePaths.end(); ++iit) { + const std::string fullPath = ((*iit) + '/' + includeString); + if (cmsys::SystemTools::FileExists(fullPath.c_str())) { + absFile = cmsys::SystemTools::GetRealPath(fullPath); + success = true; + break; + } } } - return res; + return success; } /** |