FindProducer.cmake 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  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. FindProducer
  5. ------------
  6. .. note::
  7. Producer (also known as *Open Producer*) library originated from the
  8. osgProducer utility library in early versions of the OpenSceneGraph toolkit
  9. and was later developed into a standalone library. The osgProducer was
  10. eventually replaced by the osgViewer library, and the standalone Producer
  11. library became obsolete and is no longer maintained. For details about
  12. OpenSceneGraph usage, refer to the :module:`FindOpenSceneGraph` module.
  13. Finds the Producer library, a windowing and event handling library designed
  14. primarily for real-time graphics applications:
  15. .. code-block:: cmake
  16. find_package(Producer [...])
  17. Producer library headers are intended to be included in C++ project source code
  18. as:
  19. .. code-block:: c++
  20. :caption: ``example.cxx``
  21. #include <Producer/CameraGroup>
  22. Result Variables
  23. ^^^^^^^^^^^^^^^^
  24. This module defines the following variables:
  25. ``Producer_FOUND``
  26. Boolean indicating whether Producer is found. For backward compatibility, the
  27. ``PRODUCER_FOUND`` variable is also set to the same value.
  28. Cache Variables
  29. ^^^^^^^^^^^^^^^
  30. The following cache variables may also be set:
  31. ``PRODUCER_INCLUDE_DIR``
  32. The include directory containing headers needed to use Producer.
  33. ``PRODUCER_LIBRARY``
  34. The path to the Producer library needed to link against for usage.
  35. Hints
  36. ^^^^^
  37. This module accepts the following variables:
  38. ``PRODUCER_DIR``
  39. Environment variable that can be set to help locate a custom installation of
  40. the Producer library. It should point to the root directory where the
  41. Producer library was installed. This should match the installation prefix
  42. used when configuring and building Producer, such as with
  43. ``./configure --prefix=$PRODUCER_DIR``.
  44. Because Producer was historically tightly integrated with OpenSceneGraph, this
  45. module also accepts the following environment variables as equivalents to
  46. ``PRODUCER_DIR`` for convenience to specify common installation root for
  47. multiple OpenSceneGraph-related libraries at once:
  48. ``OSGDIR``
  49. Environment variable treated the same as ``PRODUCER_DIR``.
  50. ``OSG_DIR``
  51. Environment variable treated the same as ``PRODUCER_DIR``.
  52. Examples
  53. ^^^^^^^^
  54. Finding the Producer library and creating an :ref:`imported target
  55. <Imported Targets>` that encapsulates its usage requirements for linking to a
  56. project target:
  57. .. code-block:: cmake
  58. find_package(Producer)
  59. if(Producer_FOUND AND NOT TARGET Producer::Producer)
  60. add_library(Producer::Producer INTERFACE IMPORTED)
  61. set_target_properties(
  62. Producer::Producer
  63. PROPERTIES
  64. INTERFACE_INCLUDE_DIRECTORIES "${PRODUCER_INCLUDE_DIR}"
  65. INTERFACE_LINK_LIBRARIES "${PRODUCER_LIBRARY}"
  66. )
  67. endif()
  68. target_link_libraries(example PRIVATE Producer::Producer)
  69. #]=======================================================================]
  70. # Try the user's environment request before anything else.
  71. find_path(PRODUCER_INCLUDE_DIR Producer/CameraGroup
  72. HINTS
  73. ENV PRODUCER_DIR
  74. ENV OSG_DIR
  75. ENV OSGDIR
  76. PATH_SUFFIXES include
  77. PATHS
  78. ~/Library/Frameworks
  79. /Library/Frameworks
  80. /opt
  81. [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OpenThreads_ROOT]
  82. [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT]
  83. )
  84. find_library(PRODUCER_LIBRARY
  85. NAMES Producer
  86. HINTS
  87. ENV PRODUCER_DIR
  88. ENV OSG_DIR
  89. ENV OSGDIR
  90. PATH_SUFFIXES lib
  91. PATHS
  92. /opt
  93. )
  94. include(FindPackageHandleStandardArgs)
  95. find_package_handle_standard_args(Producer DEFAULT_MSG
  96. PRODUCER_LIBRARY PRODUCER_INCLUDE_DIR)