File: comment_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 (71 lines) | stat: -rw-r--r-- 1,766 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
# test: format_off_code
# No, I really want this to look ugly
# cmake-format: off
add_library(a b.cc
  c.cc         d.cc
          e.cc)
# cmake-format: on

# test: format_off_nested
add_custom_target(
  push-github-release
  COMMAND
    # cmake-format: off
    python -Bm cmakelang.tools.push_github_release
      --message ${CMAKE_CURRENT_BINARY_DIR}/release_notes-${_version}.md
      $ENV{TRAVIS_TAG}
      ${_distdir}/cmake-format-${_version}.tar.gz
      ${_distdir}/cmake-format-${_version}-py3-none-any.whl
    # cmake-format: on
  DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/release_notes-${_version}.md
  WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})

# test: multiline comment in statement
add_custom_target(
  my-target COMMAND foo bar baz # This comment is a trailing comment
                    # But this comment is a line comment
)

# test: comment attached at correct depth
ExternalProject_Add(
  FOO
  PREFIX ${FOO_PREFIX}
  TMP_DIR ${TMP_DIR}
  STAMP_DIR ${FOO_PREFIX}/stamp
  # Download
  DOWNLOAD_DIR ${DOWNLOAD_DIR}
  DOWNLOAD_NAME ${FOO_ARCHIVE_FILE_NAME}
  URL ${STORAGE_URL}/${FOO_ARCHIVE_FILE_NAME}
  URL_MD5 ${FOO_MD5}
  # Patch
  PATCH_COMMAND ${PATCH_COMMAND} ${PROJECT_SOURCE_DIR}/patch.diff
  # Configure
  SOURCE_DIR ${SRC_DIR}
  CMAKE_ARGS ${CMAKE_OPTS}
  # Build
  BUILD_IN_SOURCE 1
  BUILD_BYPRODUCTS ${CUR_COMPONENT_ARTIFACTS}
  # Logging
  LOG_CONFIGURE 1
  LOG_BUILD 1
  LOG_INSTALL 1)

# test: comment_depth_doesnt_overbreak
#[==[
if(FOO_FOUND)
  ExternalProject_Add(
    FOO
    PREFIX ${FOO_PREFIX}
    TMP_DIR ${TMP_DIR}
# This comment belongs to the statement group
  )
endif()
]==]
if(FOO_FOUND)
  ExternalProject_Add(
    FOO
    PREFIX ${FOO_PREFIX}
    TMP_DIR ${TMP_DIR}
    # This comment belongs to the statement group
  )
endif()