From 80a007534f6287cd2e88c1b8fd72b68fc688da4e Mon Sep 17 00:00:00 2001 From: Sebastian Holtermann Date: Thu, 16 Feb 2017 19:47:40 +0100 Subject: Autogen: Add FindInIncludeDirectories method --- Source/cmQtAutoGenerators.cxx | 19 +++++++++++++++++++ Source/cmQtAutoGenerators.h | 2 ++ 2 files changed, 21 insertions(+) diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx index e3d20cf..62fbe18 100644 --- a/Source/cmQtAutoGenerators.cxx +++ b/Source/cmQtAutoGenerators.cxx @@ -1627,6 +1627,25 @@ std::string cmQtAutoGenerators::FindMatchingHeader( } /** + * @brief Tries to find a file in the include directories + * @return True on success + */ +bool cmQtAutoGenerators::FindInIncludeDirectories( + std::string& file_n, const std::string& searchString) const +{ + for (std::vector::const_iterator iit = + this->MocIncludePaths.begin(); + iit != this->MocIncludePaths.end(); ++iit) { + const std::string fullPath = ((*iit) + '/' + searchString); + if (cmsys::SystemTools::FileExists(fullPath.c_str())) { + file_n = fullPath; + return true; + } + } + return false; +} + +/** * @brief Generates the parent directory of the given file on demand * @return True on success */ diff --git a/Source/cmQtAutoGenerators.h b/Source/cmQtAutoGenerators.h index 895c50a..b3c7a3c 100644 --- a/Source/cmQtAutoGenerators.h +++ b/Source/cmQtAutoGenerators.h @@ -121,6 +121,8 @@ private: std::string FindMatchingHeader(const std::string& basePath, const std::string& baseName, const std::string& subDir) const; + bool FindInIncludeDirectories(std::string& file_n, + const std::string& searchString) const; // - Target names std::string OriginTargetName; -- cgit v0.12