aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/cmake/CMakeCopyIfDifferent.cmake
diff options
context:
space:
mode:
authorJacek Antonelli2008-09-06 18:24:57 -0500
committerJacek Antonelli2008-09-06 18:25:07 -0500
commit798d367d54a6c6379ad355bd8345fa40e31e7fe9 (patch)
tree1921f1708cd0240648c97bc02df2c2ab5f2fc41e /linden/indra/cmake/CMakeCopyIfDifferent.cmake
parentSecond Life viewer sources 1.20.15 (diff)
downloadmeta-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.cmake41
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
11MACRO(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.
19SET(AddTargets "")
20FOREACH(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})
39ENDFOREACH(SRC ${ARGN})
40SET(${TARGETS} ${AddTargets})
41ENDMACRO(COPY_IF_DIFFERENT FROM_DIR TO_DIR TARGETS)