If the project never defines <var>
through set(... CACHE)
, you are effectively defining a variable that didn’t exist before. Setting the <type>
determines the type that’s stored in the cache, which in turn changes how it’s presented in the Curses and Qt GUIs. It also affects the TYPE
property of the cache entry, and if the project happens to be reading the TYPE
property (though from my experience, most projects don’t), that could affect the outcome. (Of course, none of this matters for -P
scripts.)
Basically, you can do one or the other. Including the type has some slight advantages over not including it, and is generally preferred, but not including it generally won’t hurt anything except under some very specific corner cases. (FWIW, I often don’t include it.)