CMake : softlink resource ( such as GLSL shaders ) or copy each complilation
<p>The simplest way how to copy resources from source directory into build directory with CMake is</p>

<pre><code>file( COPY ${CMAKE_CURRENT_SOURCE_DIR}/resources DESTINATION ${CMAKE_CURRENT_BINARY_DIR} )
</code></pre>

<p>however, this updates the resources in build directory <strong>only when</strong> I call <code>cmake</code>. I need something which update resources <strong>each time I call</strong> <code>make</code>.</p>

<p>E.g. now I develop some GLSL shaders. I need to change simultaneously both the C++ code and GLSL code, and I need <strong>everything is synchronized each time I hit</strong> <code>compile</code> or <code>run</code> in my IDE ( I use CodeBlocks with project files generated by CMake )</p>

<p>The simple solution would be to make <strong>softlink</strong> from source directory to build directory. But I don't want to do it manually (it would be by-passing of CMake and would make project more fragile ). Can CMake do it for me ? </p>

<hr>

<p>just for completness, this is how my whole <code>CMakeList.txt</code> looks like</p>

<pre><code># ==== common header

cmake_minimum_required ( VERSION 2.8 )
project ( SimpleSimulationEngine )

if( UNIX )
    SET( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -std=gnu++0x" )
endif()

SET( AXULIARY_COMPILE_FLAGS "-w -O2")
SET( CMAKE_CXX_FLAGS  "${CMAKE_CXX_FLAGS} ${AXULIARY_COMPILE_FLAGS}" )
SET( COMMON_SRCS "${CMAKE_SOURCE_DIR}/common" )
include_directories(
        ${COMMON_SRCS}
        ${COMMON_SRCS}/algorithms
        ${COMMON_SRCS}/math
        ${COMMON_SRCS}/SDL2OGL3
)

set( CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR}/cmake_utils )

find_package( OpenGL REQUIRED )
find_package( GLEW   REQUIRED )
find_package( GLU    REQUIRED )
find_package( SDL2   REQUIRED )

# ==== Particular build target

add_executable       ( test_SphereShader test_SphereShader.cpp )
target_link_libraries( test_SphereShader ${OpenGL_LIBRARY} ${GLU_LIBRARY} ${GLEW_LIBRARY} ${SDL2_LIBRARY} )
file( COPY ${CMAKE_CURRENT_SOURCE_DIR}/shaders DESTINATION ${CMAKE_CURRENT_BINARY_DIR} )
</code></pre>