FindJasper.cmake 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. # Distributed under the OSI-approved BSD 3-Clause License. See accompanying
  2. # file Copyright.txt or https://cmake.org/licensing for details.
  3. #[=======================================================================[.rst:
  4. FindJasper
  5. ----------
  6. Try to find the Jasper JPEG2000 library
  7. Once done this will define
  8. ::
  9. JASPER_FOUND - system has Jasper
  10. JASPER_INCLUDE_DIR - the Jasper include directory
  11. JASPER_LIBRARIES - the libraries needed to use Jasper
  12. JASPER_VERSION_STRING - the version of Jasper found (since CMake 2.8.8)
  13. #]=======================================================================]
  14. find_path(JASPER_INCLUDE_DIR jasper/jasper.h)
  15. if (NOT JASPER_LIBRARIES)
  16. find_package(JPEG)
  17. find_library(JASPER_LIBRARY_RELEASE NAMES jasper libjasper)
  18. find_library(JASPER_LIBRARY_DEBUG NAMES jasperd)
  19. include(${CMAKE_CURRENT_LIST_DIR}/SelectLibraryConfigurations.cmake)
  20. SELECT_LIBRARY_CONFIGURATIONS(JASPER)
  21. endif ()
  22. if (JASPER_INCLUDE_DIR AND EXISTS "${JASPER_INCLUDE_DIR}/jasper/jas_config.h")
  23. file(STRINGS "${JASPER_INCLUDE_DIR}/jasper/jas_config.h" jasper_version_str REGEX "^#define[\t ]+JAS_VERSION[\t ]+\".*\".*")
  24. string(REGEX REPLACE "^#define[\t ]+JAS_VERSION[\t ]+\"([^\"]+)\".*" "\\1" JASPER_VERSION_STRING "${jasper_version_str}")
  25. endif ()
  26. include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
  27. FIND_PACKAGE_HANDLE_STANDARD_ARGS(Jasper
  28. REQUIRED_VARS JASPER_LIBRARIES JASPER_INCLUDE_DIR JPEG_LIBRARIES
  29. VERSION_VAR JASPER_VERSION_STRING)
  30. if (JASPER_FOUND)
  31. set(JASPER_LIBRARIES ${JASPER_LIBRARIES} ${JPEG_LIBRARIES} )
  32. endif ()
  33. mark_as_advanced(JASPER_INCLUDE_DIR)