I have a build rule that copies files from the source tree to the build
tree:

foreach( script ${scripts} )
  set( src  "${CMAKE_CURRENT_SOURCE_DIR}/${script}" )
  set( dest "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${script}" )
  list( APPEND dest_files "${dest}" )
  add_custom_command(
    OUTPUT "${dest}"
    COMMAND ${CMAKE_COMMAND} -E copy "${src}" "${dest}"
    MAIN_DEPENDENCY "${src}"
    COMMENT "Copying ${src} to ${dest}"
    VERBATIM
  )
endforeach()

add_custom_target( copy_scripts
  ALL
  DEPENDS ${dest_files}
  )

This then runs commands such as this:
"C:\Program Files (x86)\Programming\CMake 2.6\bin\cmake.exe" -E copy
C:/code/rtsdk/rtmain/tests/Regression/scripts/correctness.rb
C:/code/rtsdk/rtmain/build-32-vs9-c32/bin/correctness.rb

The problem I'm having is that when I go and do a make clean, I get errors
that the destination files are read only.  This isn't unexpected as the
source files are read only, but how do I work around this file permission
issue in a portable way?

I don't want to use configure file, because I want the files to be copied at
build time and not configure time.

Thanks,
James
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to