Register
Login
Resources
Docs Blog Datasets Glossary Case Studies Tutorials & Webinars
Product
Data Engine LLMs Platform Enterprise
Pricing Explore
Connect to our Discord channel

CopyDirIfDifferent.cmake 1.7 KB

You have to be logged in to leave a comment. Sign In
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
  1. #
  2. # $Id$
  3. #
  4. # Copyright (c) 1991-2015 by P. Wessel, W. H. F. Smith, R. Scharroo, J. Luis and F. Wobbe
  5. # See LICENSE.TXT file for copying and redistribution conditions.
  6. #
  7. # This program is free software; you can redistribute it and/or modify
  8. # it under the terms of the GNU Lesser General Public License as published by
  9. # the Free Software Foundation; version 3 or any later version.
  10. #
  11. # This program is distributed in the hope that it will be useful,
  12. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. # GNU Lesser General Public License for more details.
  15. #
  16. # Contact info: gmt.soest.hawaii.edu
  17. #-------------------------------------------------------------------------------
  18. # Macro definition
  19. if(NOT DEFINED _COPY_DIR_IF_DIFFERENT_CMAKE_)
  20. set(_COPY_DIR_IF_DIFFERENT_CMAKE_ "DEFINED")
  21. # copy_dir_if_different (TARGET SOURCE DEST)
  22. # example: copy_dir_if_different (copy_target srcdir/ destdir)
  23. macro (COPY_DIR_IF_DIFFERENT _TARGET _SOURCE _DEST)
  24. file(RELATIVE_PATH _rel_source ${CMAKE_SOURCE_DIR} ${_SOURCE})
  25. add_custom_target (${_TARGET}
  26. COMMAND ${CMAKE_COMMAND}
  27. -D SOURCE=${_SOURCE}
  28. -D DESTINATION=${_DEST}
  29. -D INVOKE_COPY_DIR_IF_DIFFERENT=TRUE
  30. -D CMAKE_MODULE_PATH=${CMAKE_MODULE_PATH}
  31. -P ${CMAKE_MODULE_PATH}/CopyDirIfDifferent.cmake
  32. COMMENT "Copying ${_rel_source} ..."
  33. DEPENDS ${_SOURCE})
  34. endmacro (COPY_DIR_IF_DIFFERENT)
  35. endif(NOT DEFINED _COPY_DIR_IF_DIFFERENT_CMAKE_)
  36. # Copy source directory recursively
  37. # Preserve file permissions and timestamps
  38. if (DEFINED INVOKE_COPY_DIR_IF_DIFFERENT)
  39. file (COPY ${SOURCE} DESTINATION ${DESTINATION})
  40. endif (DEFINED INVOKE_COPY_DIR_IF_DIFFERENT)
  41. # vim: textwidth=78 noexpandtab tabstop=2 softtabstop=2 shiftwidth=2
Tip!

Press p or to see the previous file or, n or to see the next file

Comments

Loading...