FindJasper.cmake 2.3 KB

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