FindOpenJPEG.cmake 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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. /opt/csw # Blastwave
  33. )
  34. FIND_PATH(OPENJPEG_INCLUDE_DIR
  35. NAMES
  36. openjpeg.h
  37. HINTS
  38. ${_openjpeg_SEARCH_DIRS}
  39. PATH_SUFFIXES
  40. include
  41. include/openjpeg-1.5
  42. )
  43. FIND_LIBRARY(OPENJPEG_LIBRARY
  44. NAMES
  45. openjpeg
  46. HINTS
  47. ${_openjpeg_SEARCH_DIRS}
  48. PATH_SUFFIXES
  49. lib64 lib
  50. )
  51. # handle the QUIETLY and REQUIRED arguments and set OPENJPEG_FOUND to TRUE if
  52. # all listed variables are TRUE
  53. INCLUDE(FindPackageHandleStandardArgs)
  54. FIND_PACKAGE_HANDLE_STANDARD_ARGS(OpenJPEG DEFAULT_MSG
  55. OPENJPEG_LIBRARY OPENJPEG_INCLUDE_DIR)
  56. IF(OPENJPEG_FOUND)
  57. SET(OPENJPEG_LIBRARIES ${OPENJPEG_LIBRARY})
  58. SET(OPENJPEG_INCLUDE_DIRS ${OPENJPEG_INCLUDE_DIR})
  59. ENDIF(OPENJPEG_FOUND)
  60. MARK_AS_ADVANCED(
  61. OPENJPEG_INCLUDE_DIR
  62. OPENJPEG_LIBRARY
  63. )
  64. UNSET(_openjpeg_SEARCH_DIRS)