title: What's the equivalent of gcc's -mwindows option in cmake?
body: <p>I'm following the tuto:</p>
  
  <p><a href="http://zetcode.com/tutorials/gtktutorial/firstprograms/" rel="noreferrer">http://zetcode.com/tutorials/gtktutorial/firstprograms/</a></p>
  
  <p>It works but each time I double click on the executable,there is a console which I don't want it there.</p>
  
  <p>How do I get rid of that console?</p>
  
  <p>I tried this:</p>
  
  <pre><code>add_executable(Cmd WIN32 cmd.c)
  </code></pre>
  
  <p>But got this fatal error:</p>
  
  <pre><code>MSVCRTD.lib(crtexew.obj) : error LNK2019: unresolved external symbol _WinMain@16 referenced in function ___tmainCRTStartup
  Cmd.exe : fatal error LNK1120: 1 unresolved externals
  </code></pre>
  
  <p>While using gcc directly works:</p>
  
  <pre><code>gcc -o Cmd cmd.c -mwindows ..
  </code></pre>
  
  <p>I'm guessing it has something to do with the entry function: <code>int main( int argc, char *argv[])</code>,but why gcc works?</p>
  
  <p>How can I make it work with <code>cmake</code>?</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>Let me paste the source code here for convenience:</p>
  
  <pre><code>#include &lt;gtk/gtk.h&gt;
  
  int main( int argc, char *argv[])
  {
    GtkWidget *window;
  
    gtk_init(&amp;argc, &amp;argv);
  
    window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
    gtk_widget_show(window);
  
    gtk_main();
  
    return 0;
  }
  </code></pre>
  
  <p><strong>UPDATE2</strong></p>
  
  <p>Why <code>gcc -mwindows</code> works but <code>add_executable(Cmd WIN32 cmd.c)</code> not?</p>
  
  <p>Maybe that's not the equivalent for <code>-mwindows</code> in cmake?</p>