FindIcotool.cmake 1.3 KB

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