diff options
author | Jacek Antonelli | 2008-09-06 18:24:57 -0500 |
---|---|---|
committer | Jacek Antonelli | 2008-09-06 18:25:07 -0500 |
commit | 798d367d54a6c6379ad355bd8345fa40e31e7fe9 (patch) | |
tree | 1921f1708cd0240648c97bc02df2c2ab5f2fc41e /linden/indra/cmake/CMakeCopyIfDifferent.cmake | |
parent | Second Life viewer sources 1.20.15 (diff) | |
download | meta-impy-798d367d54a6c6379ad355bd8345fa40e31e7fe9.zip meta-impy-798d367d54a6c6379ad355bd8345fa40e31e7fe9.tar.gz meta-impy-798d367d54a6c6379ad355bd8345fa40e31e7fe9.tar.bz2 meta-impy-798d367d54a6c6379ad355bd8345fa40e31e7fe9.tar.xz |
Second Life viewer sources 1.21.0-RC
Diffstat (limited to 'linden/indra/cmake/CMakeCopyIfDifferent.cmake')
-rw-r--r-- | linden/indra/cmake/CMakeCopyIfDifferent.cmake | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/linden/indra/cmake/CMakeCopyIfDifferent.cmake b/linden/indra/cmake/CMakeCopyIfDifferent.cmake new file mode 100644 index 0000000..55e71ff --- /dev/null +++ b/linden/indra/cmake/CMakeCopyIfDifferent.cmake | |||
@@ -0,0 +1,41 @@ | |||
1 | # -*- cmake -*- | ||
2 | # Taken from http://www.cmake.org/Wiki/CMakeCopyIfDifferent | ||
3 | # Generates a rule to copy each source file from source directory to destination directory. | ||
4 | # | ||
5 | # Typical use - | ||
6 | # | ||
7 | # SET(SRC_FILES head1.h head2.h head3.h) | ||
8 | # COPY_IF_DIFFERENT( /from_dir /to_dir IncludeTargets ${SRC_FILES}) | ||
9 | # ADD_TARGET(CopyIncludes ALL DEPENDS ${IncludeTargets}) | ||
10 | |||
11 | MACRO(COPY_IF_DIFFERENT FROM_DIR TO_DIR TARGETS) | ||
12 | # Macro to implement copy_if_different for a list of files | ||
13 | # Arguments - | ||
14 | # FROM_DIR - this is the source directory | ||
15 | # TO_DIR - this is the destination directory | ||
16 | # TARGETS - A variable to receive a list of targets | ||
17 | # FILES - names of the files to copy | ||
18 | # TODO: add globing. | ||
19 | SET(AddTargets "") | ||
20 | FOREACH(SRC ${ARGN}) | ||
21 | GET_FILENAME_COMPONENT(SRCFILE ${SRC} NAME) | ||
22 | IF("${FROM_DIR}" STREQUAL "") | ||
23 | SET(FROM ${SRC}) | ||
24 | ELSE("${FROM_DIR}" STREQUAL "") | ||
25 | SET(FROM ${FROM_DIR}/${SRC}) | ||
26 | ENDIF("${FROM_DIR}" STREQUAL "") | ||
27 | IF("${TO_DIR}" STREQUAL "") | ||
28 | SET(TO ${SRCFILE}) | ||
29 | ELSE("${TO_DIR}" STREQUAL "") | ||
30 | SET(TO ${TO_DIR}/${SRCFILE}) | ||
31 | ENDIF("${TO_DIR}" STREQUAL "") | ||
32 | ADD_CUSTOM_COMMAND( | ||
33 | OUTPUT "${TO}" | ||
34 | COMMAND ${CMAKE_COMMAND} -E copy_if_different ${FROM} ${TO} | ||
35 | DEPENDS ${FROM} | ||
36 | COMMENT "Copying ${SRCFILE} ${TO_DIR}" | ||
37 | ) | ||
38 | SET(AddTargets ${AddTargets} ${TO}) | ||
39 | ENDFOREACH(SRC ${ARGN}) | ||
40 | SET(${TARGETS} ${AddTargets}) | ||
41 | ENDMACRO(COPY_IF_DIFFERENT FROM_DIR TO_DIR TARGETS) | ||