diff options
author | Aaron Orenstein <aorenste@fb.com> | 2017-10-27 05:41:04 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2017-11-17 15:25:41 (GMT) |
commit | 4a6348dbbd35c51fabf01d517357129ed9480c85 (patch) | |
tree | b38bcaa7a1416dd90f16a54651ea61cf0cfa1f1c /Source/cmake.h | |
parent | 1fe9e49bad0ad4f540ceda028106d9af89084946 (diff) | |
download | CMake-4a6348dbbd35c51fabf01d517357129ed9480c85.zip CMake-4a6348dbbd35c51fabf01d517357129ed9480c85.tar.gz CMake-4a6348dbbd35c51fabf01d517357129ed9480c85.tar.bz2 |
Performance: Improve efficiency of source file lookup in cmMakefile
This reintroduces the change from commit v3.10.0-rc1~69^2 (Performance:
Improve efficiency of source file lookup in cmMakefile, 2017-08-17) with
some corrections. The original was rolled back by commit
v3.10.0-rc1~52^2~1 (Revert "Performance: ...", 2017-09-25) due to
incompatibilities found. The rollback was followed-up by addition of a
test for the offending case, and this revision passes the test.
Diffstat (limited to 'Source/cmake.h')
-rw-r--r-- | Source/cmake.h | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/Source/cmake.h b/Source/cmake.h index 5c5a90d..02c6cdb 100644 --- a/Source/cmake.h +++ b/Source/cmake.h @@ -8,6 +8,7 @@ #include <map> #include <set> #include <string> +#include <unordered_set> #include <vector> #include "cmInstalledFile.h" @@ -225,11 +226,27 @@ public: { return this->SourceFileExtensions; } + + bool IsSourceExtension(const std::string& ext) const + { + return this->SourceFileExtensionsSet.find(ext) != + this->SourceFileExtensionsSet.end(); + } + const std::vector<std::string>& GetHeaderExtensions() const { return this->HeaderFileExtensions; } + bool IsHeaderExtension(const std::string& ext) const + { + return this->HeaderFileExtensionsSet.find(ext) != + this->HeaderFileExtensionsSet.end(); + } + + // Strips the extension (if present and known) from a filename + std::string StripExtension(const std::string& file) const; + /** * Given a variable name, return its value (as a string). */ @@ -486,7 +503,9 @@ private: std::string CheckStampList; std::string VSSolutionFile; std::vector<std::string> SourceFileExtensions; + std::unordered_set<std::string> SourceFileExtensionsSet; std::vector<std::string> HeaderFileExtensions; + std::unordered_set<std::string> HeaderFileExtensionsSet; bool ClearBuildSystem; bool DebugTryCompile; cmFileTimeComparison* FileComparison; |