Debian Codegraph @

cmake/Modules/MacroCopyFile.cmake

raw
1 # - macro_copy_file(_src _dst)
2 # Copies a file to ${_dst} only if ${_src} is different (newer) than ${_dst}
3 #
4 # Example:
5 # macro_copy_file(${CMAKE_CURRENT_SOURCE_DIR}/icon.png ${CMAKE_CURRENT_BINARY_DIR}/.)
6 # Copies file icon.png to ${CMAKE_CURRENT_BINARY_DIR} directory
7 #
8 # Copyright (c) 2006-2007 Wengo
9 # Copyright (c) 2006-2008 Andreas Schneider <[email protected]>
10 #
11 # Redistribution and use is allowed according to the terms of the BSD license.
12 # For details see the accompanying COPYING file.
13
14
15 macro (macro_copy_file _src _dst)
16 # Removes all path containing .svn or CVS or CMakeLists.txt during the copy
17 if (NOT ${_src} MATCHES ".*\\.svn|CVS|CMakeLists\\.txt.*")
18
19 if (CMAKE_VERBOSE_MAKEFILE)
20 message(STATUS "Copy file from ${_src} to ${_dst}")
21 endif (CMAKE_VERBOSE_MAKEFILE)
22
23 # Creates directory if necessary
24 get_filename_component(_path ${_dst} PATH)
25 file(MAKE_DIRECTORY ${_path})
26
27 execute_process(
28 COMMAND
29 ${CMAKE_COMMAND} -E copy_if_different ${_src} ${_dst}
30 OUTPUT_QUIET
31 )
32 endif (NOT ${_src} MATCHES ".*\\.svn|CVS|CMakeLists\\.txt.*")
33 endmacro (macro_copy_file)