title: How to exclude source files from cmake created visual studio projects based on target architecture?
body: <p>I have a Windows Driver Kit solution that builds the dll for a printer driver.  I then convert the binary to C-code and include it into my source so that the dll can be extracted at run time and I don't have to distribute two files, just the .exe.</p>
  
  <p>However, I have to build the dll for i386 and amd64 resulting in two dlls, and thus two c files to include.  I can check at compile time for which file to include, but we are generating our Visual Studio projects using cmake, and I'd like to include the correct c file in the project, and exclude the other.  This will allow the rebuild to work, will prevent duplicated symbols, etc.</p>
  
  <p>We create the visual studio project by running cmake for either "Visual Studio 9 2008" or "Visual Studio 9 2008 Win64".  It doesn't seem possible to create a Visual Studio project for both architectures, so I could simply parse "CMAKE_GENERATOR:INTERNAL=Visual Studio 9 2008" and add to my cmakelists.txt file the appropriate check.</p>
  
  <p>Here is the cmakelists.txt file for the subproject in question</p>
  
  <pre><code>if(WIN32)
  project (StaticDriverLib)
  
  file(GLOB DriverLib_CPP *.cpp ../MasterInstallDir/*.cpp ../MasterInstallDir/amd64/*.cpp ../MasterInstallDir/i386/*.cpp)
  file(GLOB DriverLibLib_H *.hpp *.h ../MasterInstallDir/*.hpp)
  
  include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../ ${CMAKE_CURRENT_SOURCE_DIR}/../MasterInstallDir)
  
  # static DriverLibLib library
  add_library(StaticDriverLibLib ${DriverLib_CPP} ${DriverLib_H})
  add_dependencies(StaticDriverLib StaticLibCore)
  target_link_libraries(StaticDriverLib StaticCore Version.lib Setupapi.lib kernel32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib odbc32.lib odbccp32.lib)
  
  endif(WIN32)
  </code></pre>
  
  <p>As you can see, there is an i386 and an amd64 directory containing the architecture specific encoded binaries.  How do I tweak the cmakelists.txt so that one or the other is excluded based on the target generator?  For 64 bit we support VS2008 and soon VS2010.</p>