FindOpenJPEG.cmake 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. # - Find OpenJPEG library
  2. # Find the native OpenJPEG includes and library
  3. # This module defines
  4. # OPENJPEG_INCLUDE_DIRS, where to find openjpeg.h, Set when
  5. # OPENJPEG_INCLUDE_DIR is found.
  6. # OPENJPEG_LIBRARIES, libraries to link against to use OpenJPEG.
  7. # OPENJPEG_ROOT_DIR, The base directory to search for OpenJPEG.
  8. # This can also be an environment variable.
  9. # OPENJPEG_FOUND, If false, do not try to use OpenJPEG.
  10. #
  11. # also defined, but not for general use are
  12. # OPENJPEG_LIBRARY, where to find the OpenJPEG library.
  13. #=============================================================================
  14. # Copyright 2011 Blender Foundation.
  15. #
  16. # Distributed under the OSI-approved BSD License (the "License");
  17. # see accompanying file Copyright.txt for details.
  18. #
  19. # This software is distributed WITHOUT ANY WARRANTY; without even the
  20. # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  21. # See the License for more information.
  22. #=============================================================================
  23. # If OPENJPEG_ROOT_DIR was defined in the environment, use it.
  24. IF(NOT OPENJPEG_ROOT_DIR AND NOT $ENV{OPENJPEG_ROOT_DIR} STREQUAL "")
  25. SET(OPENJPEG_ROOT_DIR $ENV{OPENJPEG_ROOT_DIR})
  26. ENDIF()
  27. SET(_openjpeg_SEARCH_DIRS
  28. ${OPENJPEG_ROOT_DIR}
  29. /usr/local
  30. /sw # Fink
  31. /opt/local # DarwinPorts
  32. )
  33. FIND_PATH(OPENJPEG_INCLUDE_DIR
  34. NAMES
  35. openjpeg.h
  36. HINTS
  37. ${_openjpeg_SEARCH_DIRS}
  38. PATH_SUFFIXES
  39. include
  40. # Support future versions
  41. openjpeg-2.9
  42. openjpeg-2.8
  43. openjpeg-2.7
  44. openjpeg-2.6
  45. openjpeg-2.5
  46. openjpeg-2.4
  47. openjpeg-2.3
  48. openjpeg-2.2
  49. openjpeg-2.1
  50. openjpeg-2.0
  51. )
  52. FIND_LIBRARY(OPENJPEG_LIBRARY
  53. NAMES
  54. openjp2
  55. HINTS
  56. ${_openjpeg_SEARCH_DIRS}
  57. PATH_SUFFIXES
  58. lib64 lib
  59. )
  60. # handle the QUIETLY and REQUIRED arguments and set OPENJPEG_FOUND to TRUE if
  61. # all listed variables are TRUE
  62. INCLUDE(FindPackageHandleStandardArgs)
  63. FIND_PACKAGE_HANDLE_STANDARD_ARGS(OpenJPEG DEFAULT_MSG
  64. OPENJPEG_LIBRARY OPENJPEG_INCLUDE_DIR)
  65. IF(OPENJPEG_FOUND)
  66. SET(OPENJPEG_LIBRARIES ${OPENJPEG_LIBRARY})
  67. SET(OPENJPEG_INCLUDE_DIRS ${OPENJPEG_INCLUDE_DIR})
  68. ENDIF(OPENJPEG_FOUND)
  69. MARK_AS_ADVANCED(
  70. OPENJPEG_INCLUDE_DIR
  71. OPENJPEG_LIBRARY
  72. )
  73. UNSET(_openjpeg_SEARCH_DIRS)