[CMake] Generated files...
Lars Pechan
lars.pechan at parkerpechan.com
Wed Oct 20 22:02:48 EDT 2004
Hello,
I'm having some issues with generated files.
This is the example from the FAQ:
ADD_CUSTOM_COMMAND(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/foo.c
COMMAND ${CMAKE_COMMAND}
ARGS -E copy ${CMAKE_CURRENT_SOURCE_DIR}/bar.c
${CMAKE_CURRENT_BINARY_DIR}/foo.c
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/bar.c
)
ADD_EXECUTABLE(foo foo.c)
I thought I could do ARGS -E copy_if_different as another means of
setting up the dependency. Ie if bar.c has changed a new copy operation
will be done. I tested my theory by doing 'touch' on the original file
and that didn't have any effect at all. It appears that
copy_if_different requires more than just a newer timestamp to trigger?
The FAQ entry as it is written does trigger on a 'touch'ed source file
so there is no immediate drama.
However, I have a cvs:ed source tree where I copy some files from
various directories to build in my out-of-source tree. This means the
original files are read-only (as they clearly should be). When I do the
'touch' test CMake correctly tries to re-copy the touched file but that
fails since the original copy has been copied as a read-only file. Is
there any way around this?
Finally, I thought I'd be paranoid and ADDITIONAL_MAKE_CLEAN_FILES to
blow the sources away. Regardless of whether I do
SET(tlSources init.c chomp.c last.c)
SET_DIRECTORY_PROPERTIES(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES
${tlSources}) or
FOREACH(srcFile ${tlSources})
SET_DIRECTORY_PROPERTIES(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES
${srcFile})
ENDFOREACH(srcFile)
I end up with a ADDITIONAL_MAKE_CLEAN_FILES in the Makefile consisting
of the sole entry last.c?
All this is done using cmake-2.0.3 on WinXP generating NMake Makefiles.
Regards,
/Lars
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: text/enriched
Size: 1838 bytes
Desc: not available
Url : http://public.kitware.com/pipermail/cmake/attachments/20041021/ac18550b/attachment.bin
More information about the CMake
mailing list