File: file_tests.cmake

package info (click to toggle)
cmake-format 0.6.13-7
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 3,436 kB
  • sloc: python: 16,990; makefile: 14
file content (72 lines) | stat: -rw-r--r-- 1,788 bytes parent folder | download | duplicates (4)
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
# test: file_read
file(READ foobar.baz foobar_content)

# test: file_strings
file(STRINGS foobar.baz foorbar_content REGEX hello)

# test: file_hash
file(SHA1 foobar.baz foobar_digest)

# test: file_timestamp
file(TIMESTAMP foobar.baz foobar_timestamp)

# test: file_write
file(WRITE foobar.baz
     "first line of the output file long enough to force a wrap"
     "second line of the output file long enough to force a wrap")

# test: file_write_2
#[=[
expect_parse = [
  (NodeType.BODY, [
    (NodeType.STATEMENT, [
      (NodeType.FUNNAME, []),
      (NodeType.LPAREN, []),
      (NodeType.ARGGROUP, [
        (NodeType.PARGGROUP, [
          (NodeType.FLAG, []),
          (NodeType.ARGUMENT, []),
        ]),
        (NodeType.PARGGROUP, [
          (NodeType.ARGUMENT, []),
          (NodeType.ARGUMENT, []),
        ]),
      ]),
      (NodeType.RPAREN, []),
    ]),
    (NodeType.WHITESPACE, []),
  ]),
]
]=]
file(WRITE ${CMAKE_BINARY_DIR}/${CMAKE_PROJECT_NAME}Config.cmake
     "include(CMakeFindDependencyMacro)\n"
     "include(\${X}/${CMAKE_PROJECT_NAME}Targets.cmake)\n")

# test: file_append
file(APPEND foobar.baz
     "first line of the output file long enough to force a wrap"
     "second line of the output file long enough to force a wrap")

# test: file_generate_output
# TODO(josh): "file content line three" should probably be on the next line
file(
  GENERATE
  OUTPUT foobar.baz
  CONTENT "file content line one" #
          "file content line two" "file content line three"
  CONDITION (FOO AND BAR) OR BAZ)

# test: file_glob
file(
  GLOB globout
  RELATIVE foo/bar/baz
  "*.py" "*.txt")

# test: file_copy
file(
  COPY foo bar baz
  DESTINATION foobar
  FILE_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE
  FILES_MATCHING
  PATTERN "*.h"
  REGEX ".*\\.cc")