FindJasper.cmake 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. #.rst:
  2. # FindJasper
  3. # ----------
  4. #
  5. # Try to find the Jasper JPEG2000 library
  6. #
  7. # Once done this will define
  8. #
  9. # ::
  10. #
  11. # JASPER_FOUND - system has Jasper
  12. # JASPER_INCLUDE_DIR - the Jasper include directory
  13. # JASPER_LIBRARIES - the libraries needed to use Jasper
  14. # JASPER_VERSION_STRING - the version of Jasper found (since CMake 2.8.8)
  15. #=============================================================================
  16. # Copyright 2006-2009 Kitware, Inc.
  17. # Copyright 2006 Alexander Neundorf <neundorf@kde.org>
  18. # Copyright 2012 Rolf Eike Beer <eike@sf-mail.de>
  19. #
  20. # Distributed under the OSI-approved BSD License (the "License");
  21. # see accompanying file Copyright.txt for details.
  22. #
  23. # This software is distributed WITHOUT ANY WARRANTY; without even the
  24. # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  25. # See the License for more information.
  26. #=============================================================================
  27. # (To distribute this file outside of CMake, substitute the full
  28. # License text for the above reference.)
  29. find_path(JASPER_INCLUDE_DIR jasper/jasper.h)
  30. if (NOT JASPER_LIBRARIES)
  31. find_package(JPEG)
  32. find_library(JASPER_LIBRARY_RELEASE NAMES jasper libjasper)
  33. find_library(JASPER_LIBRARY_DEBUG NAMES jasperd)
  34. include(${CMAKE_CURRENT_LIST_DIR}/SelectLibraryConfigurations.cmake)
  35. SELECT_LIBRARY_CONFIGURATIONS(JASPER)
  36. endif ()
  37. if (JASPER_INCLUDE_DIR AND EXISTS "${JASPER_INCLUDE_DIR}/jasper/jas_config.h")
  38. file(STRINGS "${JASPER_INCLUDE_DIR}/jasper/jas_config.h" jasper_version_str REGEX "^#define[\t ]+JAS_VERSION[\t ]+\".*\".*")
  39. string(REGEX REPLACE "^#define[\t ]+JAS_VERSION[\t ]+\"([^\"]+)\".*" "\\1" JASPER_VERSION_STRING "${jasper_version_str}")
  40. endif ()
  41. # handle the QUIETLY and REQUIRED arguments and set JASPER_FOUND to TRUE if
  42. # all listed variables are TRUE
  43. include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
  44. FIND_PACKAGE_HANDLE_STANDARD_ARGS(Jasper
  45. REQUIRED_VARS JASPER_LIBRARIES JASPER_INCLUDE_DIR JPEG_LIBRARIES
  46. VERSION_VAR JASPER_VERSION_STRING)
  47. if (JASPER_FOUND)
  48. set(JASPER_LIBRARIES ${JASPER_LIBRARIES} ${JPEG_LIBRARIES} )
  49. endif ()
  50. mark_as_advanced(JASPER_INCLUDE_DIR)