File: FindKWStyle.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 (49 lines) | stat: -rw-r--r-- 1,712 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
# - 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()
    # CMake's find_package_handle_standard_args has a bug where the
    # version empty string ("") is always acceptable
    set(KWSTYLE_VERSION_STRING "?")
  endif()
endif()

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