title: How to directly execute cmake script without -P?
body: <p>I know <code>-P</code> is used to execute a cmake script file. But I don't want create a file for a simple logic. I want to execute statement like this:</p>
  
  <blockquote>
    <p>cmake "if(foo) do_something endif()"</p>
  </blockquote>
  
  <p>The reason I want this feature is that I want to use if/else in <code>add_custom_target</code> and <code>add_custom_command</code> to execute some command according to whether a <strong>CMAKE variable</strong> is defined.</p>