File: FindKWStyle.cmake

package info (click to toggle)
insighttoolkit4 4.13.3withdata-dfsg1-4
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 489,260 kB
  • sloc: cpp: 557,342; ansic: 146,850; fortran: 34,788; python: 16,572; sh: 2,187; lisp: 2,070; tcl: 993; java: 362; perl: 200; makefile: 129; csh: 81; pascal: 69; xml: 19; ruby: 10
file content (54 lines) | stat: -rw-r--r-- 1,771 bytes parent folder | download | duplicates (8)
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
# - Finds the KWStyle utility
# This module looks for KWStyle. If KWStyle is found,
# the following variables are defined:
#  KWSTYLE_FOUND - Set if KWStyle is found
#  KWSTYLE_EXECUTABLE - Path to the KWStyle executable
#  KWSTYLE_VERSION_STRING - A human-readable string containing the version of KWStyle

#=============================================================================
# Copyright 2008-2013 Kitware, Inc.
# Copyright 2013 Brian Helba
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
#
# This software is distributed WITHOUT ANY WARRANTY; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the License for more information.
#=============================================================================

find_program(
  KWSTYLE_EXECUTABLE
  NAMES KWStyle
  DOC "Path to the KWStyle executable"
  )
mark_as_advanced(KWSTYLE_EXECUTABLE)

if(KWSTYLE_EXECUTABLE)
  execute_process(
    COMMAND ${KWSTYLE_EXECUTABLE} -version
    OUTPUT_VARIABLE KWSTYLE_VERSION_STRING
    ERROR_QUIET
    OUTPUT_STRIP_TRAILING_WHITESPACE
    )
  if(KWSTYLE_VERSION_STRING)
    # string(REPLACE ..) fails if the input is an empty string
    string(REPLACE
      "Version: "
      ""
      KWSTYLE_VERSION_STRING
      ${KWSTYLE_VERSION_STRING}
      )
  else(KWSTYLE_VERSION_STRING)
    # CMake's find_package_handle_standard_args has a bug where the
    # version empty string ("") is always acceptable
    set(KWSTYLE_VERSION_STRING "?")
  endif(KWSTYLE_VERSION_STRING)
endif(KWSTYLE_EXECUTABLE)

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(
  KWStyle
  REQUIRED_VARS KWSTYLE_EXECUTABLE
  VERSION_VAR KWSTYLE_VERSION_STRING
  )