title: CMake if(DEFINED MY_COMPILE_DEF) does not work. How can I use precompile definition as conditional?
body: <p>I'm trying to use a compile definition as a conditional to build a Gtest executable. The problematic CMake code is as follows: </p>
  
  <pre><code>add_compile_definitions(TEST_BENCH)
  if(DEFINED TEST_BENCH)
    enable_testing()
  endif()
  </code></pre>
  
  <p>This does not work though. I've read a few similar questions and answers that have been regarding the use of ${my_var} syntax which is not the case in my code. </p>
  
  <p>Can compile definitions be used in conditionals, and if so how? </p>