summaryrefslogtreecommitdiffstats
path: root/Source/cmake.h
diff options
context:
space:
mode:
authorAaron Orenstein <aorenste@fb.com>2017-10-27 05:41:04 (GMT)
committerBrad King <brad.king@kitware.com>2017-11-17 15:25:41 (GMT)
commit4a6348dbbd35c51fabf01d517357129ed9480c85 (patch)
treeb38bcaa7a1416dd90f16a54651ea61cf0cfa1f1c /Source/cmake.h
parent1fe9e49bad0ad4f540ceda028106d9af89084946 (diff)
downloadCMake-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.h19
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;