1# Distributed under the OSI-approved BSD 3-Clause License.  See accompanying
2# file Copyright.txt or https://cmake.org/licensing for details.
3
4#[=======================================================================[.rst:
5FindIcotool
6-----------
7
8Find icotool
9
10This module looks for icotool. Convert and create Win32 icon and cursor files.
11This module defines the following values:
12
13::
14
15  ICOTOOL_EXECUTABLE: the full path to the icotool tool.
16  ICOTOOL_FOUND: True if icotool has been found.
17  ICOTOOL_VERSION_STRING: the version of icotool found.
18#]=======================================================================]
19
20find_program(ICOTOOL_EXECUTABLE
21  icotool
22)
23
24if(ICOTOOL_EXECUTABLE)
25  execute_process(
26    COMMAND ${ICOTOOL_EXECUTABLE} --version
27    OUTPUT_VARIABLE _icotool_version
28    ERROR_QUIET
29    OUTPUT_STRIP_TRAILING_WHITESPACE
30  )
31  if("${_icotool_version}" MATCHES "^icotool \\([^\\)]*\\) ([0-9\\.]+[^ \n]*)")
32    set( ICOTOOL_VERSION_STRING
33      "${CMAKE_MATCH_1}"
34    )
35  else()
36    set( ICOTOOL_VERSION_STRING
37      ""
38    )
39  endif()
40  unset(_icotool_version)
41endif()
42
43include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
44FIND_PACKAGE_HANDLE_STANDARD_ARGS(
45  Icotool
46  REQUIRED_VARS ICOTOOL_EXECUTABLE
47  VERSION_VAR ICOTOOL_VERSION_STRING
48)
49
50mark_as_advanced(
51  ICOTOOL_EXECUTABLE
52)
53