title: CMake post build step: copy multiple files dependent on visual studio configuration
body: <p>I'm trying to write a <code>CMakeLists.txt</code> which copies as a post build event required <code>dlls</code> from external libraries to the folder in which the executable is located after building. The OS I'm working on is Win7 and VS2010.</p>
  
  <p>There a quite a lot of external libraries, so I do not want to list them individually within the <code>CMakeLists.txt</code>. My current solution is to use file globbing and create a post build event for each library:</p>
  
  <pre><code>FILE(GLOB files "${LIBRARY_DIR}/lib/$(ConfigurationName)/*dll")
  MESSAGE("FILE LIST IS: ${files}")
  FOREACH(file ${files})
      ADD_CUSTOM_COMMAND(
          TARGET mylib
          POST_BUILD
          COMMENT "Copying dll ${file}..."
          COMMAND ${CMAKE_COMMAND} -E copy ${file} "${CMAKE_BINARY_DIR}/$(ConfigurationName)/"
      )
  ENDFOREACH()
  </code></pre>
  
  <p>Basically, the code snipped above works file if I replace <code>$(ConfigurationName)</code> with <code>Release</code> or <code>Debug</code>. However, I'd like to take the libraries from the corresponding directory dependent on Release or Debug build mode. In the code snipped above, <code>$(ConfigurationName)</code> does not get substituted by the visual studio build mode. I guess this is due to that this is a VS2010 variable which isn't known at cmake generation time).</p>
  
  <p>Does somebody have a smart idea how to resolve this issue?</p>