FindJasper.cmake 2.2 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 jasperd)
  27. include(${CMAKE_CURRENT_LIST_DIR}/SelectLibraryConfigurations.cmake)
  28. SELECT_LIBRARY_CONFIGURATIONS(JASPER)
  29. endif ()
  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 ()
  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 ()
  43. mark_as_advanced(JASPER_INCLUDE_DIR)