title: Is there a generic way for disabling executable targets in cmake
body: <p>With our CMake build system I build some libraries and some executables. The build products are all output to a specific folder.</p>
  
  <p>Now, the problem is I have a VS2010 and a VS2008 toolchain but I only need the VS2008 toolchain for VS2008 libraries. The output executables are win32 target for both toolchains so I only need to build the executables once via the VS2010 toolchain while the VS2008 toolchain should just skip the executables and build only the desired libraries (which saves build time).</p>
  
  <p>The CMake base scripts and overall setup may also be delivered to customers in the future so it would be very nice if there is a way, in CMake, to disable certain targets, like all executables in a generic way. Otherwise, I have to write many big <code>IF( BUILD_EXECUTABLES )  ... ENDIF()</code> constructs around my executables setup in my <code>CMakeLists.txt</code>, without CMake giving me errors when I forget them. </p>
  
  <p>The build is triggered via some batch files. Ideally, I want to pass a variable to <code>cmake</code> via the <code>-D</code> option (e.g. <code>-D BUILD_EXECUTABLES=false</code>)</p>
  
  <p>I tried to wrap the <code>ADD_EXECUTABLE</code> macros but that does not work since I have calls like 
  <code>TARGET_LINK_LIBRARIES</code> which then complain about the nonexistent target.</p>
  
  <p>I could also set the output directory to some garbage folder which could be deleted afterwards, but that (as already mentioned) would not save build time. (We have a quite huge project.)</p>
  
  <p>Any ideas for how to accomplish that in clean and generic way?</p>