File: KWStyle.cmake

package info (click to toggle)
insighttoolkit5 5.4.4-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 704,404 kB
  • sloc: cpp: 783,697; ansic: 628,724; xml: 44,704; fortran: 34,250; python: 22,874; sh: 4,078; pascal: 2,636; lisp: 2,158; makefile: 461; yacc: 328; asm: 205; perl: 203; lex: 146; tcl: 132; javascript: 98; csh: 81
file content (65 lines) | stat: -rw-r--r-- 2,417 bytes parent folder | download | duplicates (2)
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
if(ITK_USE_KWSTYLE)
  # Define and configure configuration files
  set(kwstyle_itk_configuration_file ${ITK_SOURCE_DIR}/Utilities/KWStyle/ITK.kws.xml)
  set(kwstyle_itk_examples_files_list_file ${ITK_BINARY_DIR}/Utilities/KWStyle/ITKExamplesFiles.txt)
  configure_file(# KWStyle requires that the files list be absolute paths
                 ${ITK_SOURCE_DIR}/Utilities/KWStyle/ITKExamplesFiles.txt.in ${kwstyle_itk_examples_files_list_file})
  set(kwstyle_itk_overwrite_file ${ITK_SOURCE_DIR}/Utilities/KWStyle/ITKOverwrite.txt)

  # Define formatting for error messages for output of build target
  option(KWSTYLE_USE_VIM_FORMAT "Set KWStyle to generate errors with a VIM-compatible format." OFF)
  option(KWSTYLE_USE_GCC_FORMAT "Set KWStyle to generate errors with a GCC-compatible format." OFF)
  option(KWSTYLE_USE_MSVC_FORMAT "Set KWStyle to generate errors with a VisualStudio-compatible format."
         ${MSVC_IDE} # default to TRUE only with a Visual Studio IDE
  )

  mark_as_advanced(KWSTYLE_USE_VIM_FORMAT)
  mark_as_advanced(KWSTYLE_USE_GCC_FORMAT)
  mark_as_advanced(KWSTYLE_USE_MSVC_FORMAT)

  set(kwstyle_editor_format "")
  if(KWSTYLE_USE_VIM_FORMAT)
    list(APPEND kwstyle_editor_format -vim)
  endif()
  if(KWSTYLE_USE_GCC_FORMAT)
    list(APPEND kwstyle_editor_format -gcc)
  endif()
  if(KWSTYLE_USE_MSVC_FORMAT)
    list(APPEND kwstyle_editor_format -msvc)
  endif()

  list(LENGTH kwstyle_editor_format kwstyle_editor_format_length)
  if(kwstyle_editor_format_length GREATER 1)
    message(FATAL_ERROR "At most, only one of KWSTYLE_USE_*_FORMAT can be set to TRUE.")
  endif()

  # Add build target and CTest test
  set(kwstyle_common_arguments
      -xml
      ${kwstyle_itk_configuration_file}
      -v
      -o
      ${kwstyle_itk_overwrite_file})
  add_custom_target(
    StyleCheckExamples
    COMMAND ${KWSTYLE_EXECUTABLE} ${kwstyle_common_arguments} -D ${kwstyle_itk_examples_files_list_file}
            ${kwstyle_editor_format}
    COMMENT "Examples Style Checker"
    WORKING_DIRECTORY ${ITK_SOURCE_DIR} # the paths in kwstyle_itk_configuration_file are relative
  )
  if(BUILD_TESTING)
    set(itk-module KWStyle)
    itk_add_test(
      NAME
      KWStyleExamplesTest
      COMMAND
      ${KWSTYLE_EXECUTABLE}
      ${kwstyle_common_arguments}
      -D
      ${kwstyle_itk_examples_files_list_file}
      -gcc
      WORKING_DIRECTORY
      ${ITK_SOURCE_DIR})
  endif()

endif()