I am preparing an application which should work with and without GUI, so I use in my CMakeLists.txt the command
option (NEED_GUI \"Include Qt support\" OFF) >
if (NEED_GUI MATCHES ON)
is the appropriate usage rather than
if (NEED_GUI)