FindIcotool.cmake 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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. #
  7. # Find icotool
  8. #
  9. # This module looks for icotool. This module defines the following
  10. # values:
  11. #
  12. # ::
  13. #
  14. # ICOTOOL_EXECUTABLE: the full path to the icotool tool.
  15. # ICOTOOL_FOUND: True if icotool has been found.
  16. # ICOTOOL_VERSION_STRING: the version of icotool found.
  17. find_program(ICOTOOL_EXECUTABLE
  18. icotool
  19. )
  20. if(ICOTOOL_EXECUTABLE)
  21. execute_process(
  22. COMMAND ${ICOTOOL_EXECUTABLE} --version
  23. OUTPUT_VARIABLE _icotool_version
  24. ERROR_QUIET
  25. OUTPUT_STRIP_TRAILING_WHITESPACE
  26. )
  27. if("${_icotool_version}" MATCHES "^icotool \\([^\\)]*\\) ([0-9\\.]+[^ \n]*)")
  28. set( ICOTOOL_VERSION_STRING
  29. "${CMAKE_MATCH_1}"
  30. )
  31. else()
  32. set( ICOTOOL_VERSION_STRING
  33. ""
  34. )
  35. endif()
  36. unset(_icotool_version)
  37. endif()
  38. include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
  39. FIND_PACKAGE_HANDLE_STANDARD_ARGS(
  40. Icotool
  41. REQUIRED_VARS ICOTOOL_EXECUTABLE
  42. VERSION_VAR ICOTOOL_VERSION_STRING
  43. )
  44. mark_as_advanced(
  45. ICOTOOL_EXECUTABLE
  46. )