2010/9/30 Guillaume Duhamel <guillaume.duha...@gmail.com>: > Hi, > I'm trying to use "file(COPY ..." during the build of one of my project.
"file(COPY ..." is a **CMake-time** command, i.e. it will be processed when CMake runs and not when building (unless make is triggering a cmake run) If you want **Build-time** command you'll have to use add_custom_command/add_custom_target > The documentation says that files get overwritten according to their > timestamps, but it seems they just never get overwritten. > For instance, with this CMakeLists : > =================================== > project(test) > cmake_minimum_required(VERSION 2.8) > file(INSTALL dir DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) > file(INSTALL bar.txt DESTINATION ${test_BINARY_DIR}/dir) > =================================== > and those steps : > $ mkdir build && cd build && cmake .. && make > $ echo "something new" >> ../bar.txt > $ make > bar.txt doesn't get overwritten after the second make. > Is there anything I'm doing wrong or do I have to detect existing files > and remove them before the copy? try add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/dir ${CMAKE_CURRENT_BINARY_DIR}/dir/bar.txt COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/dir ${CMAKE_CURRENT_BINARY_DIR}/dir COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_SOURCE_DIR}/bar.txt ${CMAKE_CURRENT_BINARY_DIR}/dir/bar.txt ) or something similar. -- Erk Membre de l'April - « promouvoir et défendre le logiciel libre » - http://www.april.org _______________________________________________ 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