FindIcotool.cmake 1.7 KB

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