title: Copy file from source directory to binary directory using CMake
body: <p>I'm trying to create a simple project on CLion. It uses CMake (I'm new here) to generate Makefiles to build project (or some sort of it)</p>
  
  <p>All I need to is transfer some non-project file (some sort of resource file) to binary directory each time when I run the my code.</p>
  
  <p>That file contains test data and application open it to read them. I tried several ways to do so:</p>
  
  <ul>
  <li><p>Via <code>file(COPY ...</code></p>
  
  <pre><code>file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/input.txt
          DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/input.txt
  </code></pre>
  
  <p>Looking good but it work just once and not recopy file after next run.</p></li>
  <li><p>Via <code>add_custom_command</code></p>
  
  <ul>
  <li><p><code>OUTPUT</code> version</p>
  
  <pre><code>add_custom_command(
          OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/input.txt
          COMMAND ${CMAKE_COMMAND} -E copy
                  ${CMAKE_CURRENT_SOURCE_DIR}/input.txt
                  ${CMAKE_CURRENT_BINARY_DIR}/input.txt)
  </code></pre></li>
  <li><p><code>TARGET</code> version</p>
  
  <pre><code>add_custom_target(foo)
  add_custom_command(
          TARGET foo
          COMMAND ${CMAKE_COMMAND} copy
                  ${CMAKE_CURRENT_BINARY_DIR}/test/input.txt
                  ${CMAKE_SOURCE_DIR})
  </code></pre></li>
  </ul>
  
  <p>But no one of it work.</p></li>
  </ul>
  
  <p>What am I doing wrong?</p>