title: cmake: auto generate build directory
body: <p>I am planning to use CMake to build cross platform/cross compiler solution. Imagine the tree like this:</p>
  
  <pre>
  project
    |__include
    |__src
    |__buildrules
  </pre>
  
  <p>The directory buildrules will contain my CMake extensions and common sub-projects options plus some scripts to initiate the build on different platforms (.sh .bat files). I intend to use <em>the same</em> source tree to build using different compilers/configurations. So on NT I will need to be able to produce VS project files for development and NMake makefiles for commmand line batch build. On linux the same tree can be used to build using different compilers (gcc, clang, icc) in 32/64 variants. So buildrules is not the directory for CMake cache. I need different build directory for each configuration/generator with different names (name specific to configuration/generator).</p>
  
  <p>Now almost every CMake tutorial start with something like "create build subdirectory, run cmake, run make". This seem rather undesirable to me. I need fully automated build system, so it can be run by "single click". I want to be able to run some command from buildrules (one of my shortcut batch files for example) and it should create properly names build directory under project root (if it is not there yet), run cmake in that directory to produce cache (if it was not done before) and start build by invoking correct tool: on unix invoke make, in windows command line invoke nmake, for VC solution either start one or invoke batch build etc. </p>
  
  <p>Most importantly I want all of that to be done by cmake itself - I do not want to write yet another portability level on top of it using different platform specific tools. The only platform specific thing I can tolerate is difference between cmake cmake.exe.</p>
  
  <p>So, do you think this can be done?</p>
  
  <p>I'd really appreciate if someone can help me with this setup. </p>
  
  <p>Thank you.</p>