FindHTMLHelp.cmake 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. # Distributed under the OSI-approved BSD 3-Clause License. See accompanying
  2. # file LICENSE.rst or https://cmake.org/licensing for details.
  3. #[=======================================================================[.rst:
  4. FindHTMLHelp
  5. ------------
  6. Finds the Microsoft HTML Help Compiler and its API which is part of the HTML
  7. Help Workshop:
  8. .. code-block:: cmake
  9. find_package(HTMLHelp [...])
  10. .. note::
  11. HTML Help Workshop is in maintenance mode only and is considered deprecated.
  12. For modern documentation, consider alternatives such as Microsoft Help Viewer
  13. for producing ``.mshc`` files or web-based documentation tools.
  14. Result Variables
  15. ^^^^^^^^^^^^^^^^
  16. This module defines the following variables:
  17. ``HTMLHelp_FOUND``
  18. .. versionadded:: 4.2
  19. Boolean indicating whether HTML Help was found.
  20. Cache Variables
  21. ^^^^^^^^^^^^^^^
  22. The following cache variables may also be set:
  23. ``HTML_HELP_COMPILER``
  24. Full path to the HTML Help Compiler (``hhc.exe``), used to compile ``.chm``
  25. files.
  26. ``HTML_HELP_INCLUDE_PATH``
  27. Directory containing ``htmlhelp.h``, required for applications integrating the
  28. HTML Help API.
  29. ``HTML_HELP_LIBRARY``
  30. Full path to ``htmlhelp.lib`` library, required for linking applications that
  31. use the HTML Help API.
  32. Examples
  33. ^^^^^^^^
  34. Finding HTML Help Compiler:
  35. .. code-block:: cmake
  36. find_package(HTMLHelp)
  37. message(STATUS "HTML Help Compiler found at: ${HTML_HELP_COMPILER}")
  38. #]=======================================================================]
  39. if(WIN32)
  40. find_program(HTML_HELP_COMPILER
  41. NAMES hhc
  42. PATHS
  43. "[HKEY_CURRENT_USER\\Software\\Microsoft\\HTML Help Workshop;InstallDir]"
  44. PATH_SUFFIXES "HTML Help Workshop"
  45. )
  46. get_filename_component(HTML_HELP_COMPILER_PATH "${HTML_HELP_COMPILER}" PATH)
  47. find_path(HTML_HELP_INCLUDE_PATH
  48. NAMES htmlhelp.h
  49. PATHS
  50. "${HTML_HELP_COMPILER_PATH}/include"
  51. "[HKEY_CURRENT_USER\\Software\\Microsoft\\HTML Help Workshop;InstallDir]/include"
  52. PATH_SUFFIXES "HTML Help Workshop/include"
  53. )
  54. find_library(HTML_HELP_LIBRARY
  55. NAMES htmlhelp
  56. PATHS
  57. "${HTML_HELP_COMPILER_PATH}/lib"
  58. "[HKEY_CURRENT_USER\\Software\\Microsoft\\HTML Help Workshop;InstallDir]/lib"
  59. PATH_SUFFIXES "HTML Help Workshop/lib"
  60. )
  61. mark_as_advanced(
  62. HTML_HELP_COMPILER
  63. HTML_HELP_INCLUDE_PATH
  64. HTML_HELP_LIBRARY
  65. )
  66. endif()
  67. if(HTML_HELP_COMPILER AND HTML_HELP_INCLUDE_PATH AND HTML_HELP_LIBRARY)
  68. set(HTMLHelp_FOUND TRUE)
  69. else()
  70. set(HTMLHelp_FOUND FALSE)
  71. endif()