title: CMAKE avoid compilation of HLSL shader files on Visual Studio
body: <p>I have a DirectX11 project with CMake on Windows. 
  The project contains (at least) three sub-projects - one is for the core 3D engine library - a common asset directory which contains all the binary data used by the test or sample apps that builds on top of the engine.</p>
  
  <pre><code>./ 
  +-- src/
  |   +-- api/
  |       +-- CmakeLists.txt
  +-- tests/
  |   +-- assets/
  |   |   +-- shaders/
  |   |   |   +-- 1.hlsl
  |   |   |   +-- 2.hlsl
  |   |   |       ...
  |   |   +-- images/
  |   |   |       ...
  |   |   +-- models/
  |   |   |       ...
  |   |   +-- CmakeLists.txt
  |   +-- sampleApp1/
  |   |   +-- CmakeLists.txt
  |   |        ...
  |   +-- sampleApp2 
  |   |   +-- CmakeLists.txt
  |   |   +-- ...
  |   |   ... 
  |   +-- CmakeLists.txt
  +-- CmakeLists.txt
  </code></pre>
  
  <p>The asset files are just being copied in relative to the test projects binary dir (<code>${CMAKE_CURRENT_BINARY_DIR}</code>) to make them available in relative to their work directory (<code>../assets</code>). </p>
  
  <p>I have <code>hlsl</code> shader files in assets as well. When such files are being added to the project with CMake, VS will treat them as compilable source - obviously - which I wish to avoid, because I want such files to be edited with the IDE and just copy them to the binary folder and use the engine to compile, rather than let VS to do it. </p>
  
  <p>I have tried to set as header file, like another source files that I wish to avoid building, but it seems that something sets them as shader file and overrides this for some reason. </p>
  
  <p>Here is my setup I'm attempting with:</p>
  
  <pre><code>cmake_minimum_required (VERSION 2.6)
  project (Project)
  subdirs(assets)
  </code></pre>
  
  <p>In the asset folder I have the following:</p>
  
  <pre><code>file(GLOB_RECURSE FILES *.*)
  
  add_custom_target(assets SOURCES ${FILES})
  set_target_properties(assets PROPERTIES FOLDER tests)
  
  # copy static sources 
  foreach(_source IN ITEMS ${FILES})
  
      # this does not work for some reason
      set_source_files_properties(${_source} PROPERTIES HEADER_FILE_ONLY TRUE)
  
      if (IS_ABSOLUTE "${_source}")
          file(RELATIVE_PATH _source_rel "${CMAKE_CURRENT_SOURCE_DIR}" "${_source}")
      else()
          set(source_rel "${_source}")
      endif()
  
      get_filename_component(_source_path "${_source_rel}" PATH)
      get_filename_component(_source_name "${_source_rel}" NAME)    
      set(dst_path "${CMAKE_CURRENT_BINARY_DIR}/${_source_path}")
  
      file(MAKE_DIRECTORY ${dst_path})
  
      # -- win32 only
      if (WIN32)
          string(REPLACE "/" "\\" _source "${_source}")
          string(REPLACE "/" "\\" _dest "${dst_path}/${_source_name}")
      else()
          message("win32 required")
      endif(WIN32)
  
      add_custom_command(
          TARGET assets
          COMMAND copy ${_source} ${_dest}
          DEPENDS ${_source}
      )
  
  endforeach()
  </code></pre>
  
  <p>I have tried the following method described in <a href="https://stackoverflow.com/questions/20007840/adding-files-to-cmake-but-not-compiling-them">this answer</a>, but didn't succeed.</p>