File: MakeDistFiles.cmake

package info (click to toggle)
mongo-c-driver 1.14.0-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 31,116 kB
  • sloc: ansic: 124,705; python: 2,971; sh: 138; makefile: 23
file content (77 lines) | stat: -rw-r--r-- 2,144 bytes parent folder | download | duplicates (3)
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77

if (${CMAKE_VERSION} VERSION_LESS 3.5)
   include (CMakeParseArguments)
endif ()

function (SET_LOCAL_DIST output)
   set (dist_files "")
   foreach (file ${ARGN})
      file (RELATIVE_PATH
         relative
         ${CMAKE_SOURCE_DIR}
         ${CMAKE_CURRENT_SOURCE_DIR}/${file}
      )
      list (APPEND dist_files ${relative})
   endforeach ()
   set (${output} ${dist_files} PARENT_SCOPE)
endfunction ()

macro (SET_DIST_LIST output)
   set_local_dist (${output}_TMP ${ARGN})
   set (${output} ${${output}_TMP} PARENT_SCOPE)
endmacro ()

function (EXECUTE_PROCESS_AND_CHECK_RESULT)
   cmake_parse_arguments (VARS
      ""
      "WORKING_DIRECTORY;ERROR_MSG"
      "COMMAND"
      ${ARGN}
   )
   execute_process (COMMAND
      ${VARS_COMMAND}
      WORKING_DIRECTORY ${VARS_WORKING_DIRECTORY}
      RESULT_VARIABLE RESULT
   )
   if (NOT "${RESULT}" STREQUAL "0")
      message (FATAL_ERROR ${VARS_ERROR_MSG})
   endif ()
endfunction ()

# Add a file or list of files to the distribution manifest to be included in the
# archive. The parameter _is_built distinguishes between files that appear in
# the source tree and those which are generated and then appear in the binary,
# or built, tree.
function (EXTRA_DIST_INTERNAL _is_built)
   if (_is_built)
      set (DIST_BUILD_SOURCE_DIR ${CMAKE_BINARY_DIR})
      set (DIST_CURRENT_BUILD_SOURCE_DIR ${CMAKE_CURRENT_BINARY_DIR})
   else ()
      set (DIST_BUILD_SOURCE_DIR ${CMAKE_SOURCE_DIR})
      set (DIST_CURRENT_BUILD_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
   endif ()

   set (local_generated ${dist_generated})
   foreach (gen_file ${ARGN})
      file (RELATIVE_PATH
         rel_gen
         ${DIST_BUILD_SOURCE_DIR}
         ${DIST_CURRENT_BUILD_SOURCE_DIR}/${gen_file}
      )
      list (APPEND local_generated ${rel_gen})
   endforeach ()
   set (dist_generated
      ${local_generated}
      CACHE
      INTERNAL
      "generated files that will be included in the distribution tarball"
   )
endfunction ()

function (EXTRA_DIST_SOURCE)
   extra_dist_internal (NO ${ARGN})
endfunction ()

function (EXTRA_DIST_GENERATED)
   extra_dist_internal (YES ${ARGN})
endfunction ()