title: CMake Option to Disable Compilation on Specific Files for Specific Platforms
body: <p>I am using CMake to define my projects.  My goal is to have platform-specific files easily accessible for editing, searching, browsing, and source control with across all platforms.</p>
  
  <p>I currently have platform-specific files separated in the cmake description.  My CMakeLists.txt file looks something like the following:</p>
  
  <pre><code> Foo.hpp
   ${platform_directory}/Foo.cpp
  </code></pre>
  
  <p>Then on disk I have something like this:</p>
  
  <pre><code> Foo.hpp
   win
    `- Foo.cpp 
   osx
    `- Foo.cpp 
  </code></pre>
  
  <p>Which in the generated project file looks like:</p>
  
  <pre><code> Foo.hpp
   Foo.cpp (platform-specific version)
  </code></pre>
  
  <p>This is perfect for the compiler, but it means that developers lack IDE tooling for non-native platform-specific files.</p>
  
  <p>What I am looking for is something like this (in Xcode):</p>
  
  <pre><code> Foo.hpp
   Foo.cpp (OS X version)
   win
    `- Foo.cpp (file type set to plain text)
  </code></pre>
  
  <p>Or in Visual Studio:</p>
  
  <pre><code> Foo.hpp
   Foo.cpp (Windows version)
   osx
    `- Foo.cpp (build action set to none)
  </code></pre>
  
  <p>Any ideas on how something like this can be setup CMake?</p>