ENH: Use if(DEFINED) to simplify conditions

Replace old hacks of the form 'if("${VAR}" MATCHES "^${VAR}$")'
with the much simpler 'if(NOT DEFINED ${VAR})'.

Change-Id: I6d21632ccfdbdd8dda0cec515231311f47a4ce7a
Merge topic 'simplify-if-conditions'

f910d5e7 ENH: Use if(DEFINED) to simplify conditions