cmSourceFileLocation: Avoid string allocation in extension checking

The substr call was causing excess allocations. Swap the cheaper
character check to be before the longer string comparison, now using the
prefix checking function.
cmSourceFileLocation: Simplify logic in Matches
cmSourceFileLocation: Save some string copies
cmSourceFileLocation: Return a string reference
cmSourceFile: Cache the isUiFile check

The filename extension call is expensive, so cache the .ui check.
perf: Cache the language property string
cmSourceFile: Take a string
ClearMatches: Only clear matches which were actually set

ClearMatches was clearing many variables which were never set in the
first place. Instead, store how many matches were made last time and
only clear those. It is moved to the cmMakefile class since it is a
common utility used by multiple commands.
ClearMatches: Store match variable names statically

Constructing the names and then turning them into a std::string is
non-negligible in performance testing.
StoreMatches: Minor cleanups
cmMakefile: Use a hashmap for imported targets
cmGlobalGenerator: Store targets in hash maps
Merge topic 'dev/hashmap-for-targets'

325599ca cmGlobalGenerator: Store targets in hash maps
ac4106c6 cmMakefile: Use a hashmap for imported targets
Merge topic 'dev/regex-variables'

3f517522 StoreMatches: Minor cleanups
ef62fbad ClearMatches: Store match variable names statically
f718b30a ClearMatches: Only clear matches which were actually set
Merge topic 'dev/source-file-performance'

77b37965 cmSourceFile: Take a string
7b8a9904 perf: Cache the language property string
10baf00f cmSourceFile: Cache the isUiFile check
14e7a8ae cmSourceFileLocation: Return a string reference
b4cb543e cmSourceFileLocation: Save some string copies
e8e1f3a1 cmSourceFileLocation: Simplify logic in Matches
5554910e cmSourceFileLocation: Avoid string allocation in extension checking