FindIcotool.cmake 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. #.rst:
  2. # FindIcotool
  3. # -----------
  4. #
  5. # Find icotool
  6. #
  7. # This module looks for icotool. This module defines the following
  8. # values:
  9. #
  10. # ::
  11. #
  12. # ICOTOOL_EXECUTABLE: the full path to the icotool tool.
  13. # ICOTOOL_FOUND: True if icotool has been found.
  14. # ICOTOOL_VERSION_STRING: the version of icotool found.
  15. #=============================================================================
  16. # Copyright 2012 Aleksey Avdeev <solo@altlinux.ru>
  17. #
  18. # Distributed under the OSI-approved BSD License (the "License");
  19. # see accompanying file Copyright.txt for details.
  20. #
  21. # This software is distributed WITHOUT ANY WARRANTY; without even the
  22. # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  23. # See the License for more information.
  24. #=============================================================================
  25. # (To distribute this file outside of CMake, substitute the full
  26. # License text for the above reference.)
  27. find_program(ICOTOOL_EXECUTABLE
  28. icotool
  29. )
  30. if(ICOTOOL_EXECUTABLE)
  31. execute_process(
  32. COMMAND ${ICOTOOL_EXECUTABLE} --version
  33. OUTPUT_VARIABLE _icotool_version
  34. ERROR_QUIET
  35. OUTPUT_STRIP_TRAILING_WHITESPACE
  36. )
  37. if("${_icotool_version}" MATCHES "^icotool \\([^\\)]*\\) ([0-9\\.]+[^ \n]*)")
  38. set( ICOTOOL_VERSION_STRING
  39. "${CMAKE_MATCH_1}"
  40. )
  41. else()
  42. set( ICOTOOL_VERSION_STRING
  43. ""
  44. )
  45. endif()
  46. unset(_icotool_version)
  47. endif()
  48. # handle the QUIETLY and REQUIRED arguments and set ICOTOOL_FOUND to TRUE if
  49. # all listed variables are TRUE
  50. include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
  51. FIND_PACKAGE_HANDLE_STANDARD_ARGS(
  52. Icotool
  53. REQUIRED_VARS ICOTOOL_EXECUTABLE
  54. VERSION_VAR ICOTOOL_VERSION_STRING
  55. )
  56. mark_as_advanced(
  57. ICOTOOL_EXECUTABLE
  58. )