[CMake] Make clean in VS can't delete read only files

James Bigler jamesbigler at gmail.com
Tue Nov 9 19:17:25 EST 2010


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20101109/e36b1c75/attachment.htm>


More information about the CMake mailing list