2016-09-27 22:01:08 +03:00
|
|
|
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
|
|
|
# file Copyright.txt or https://cmake.org/licensing for details.
|
|
|
|
|
2013-10-15 19:17:36 +04:00
|
|
|
#.rst:
|
|
|
|
# FindJasper
|
|
|
|
# ----------
|
|
|
|
#
|
|
|
|
# Try to find the Jasper JPEG2000 library
|
|
|
|
#
|
2006-09-20 00:11:53 +04:00
|
|
|
# Once done this will define
|
|
|
|
#
|
2013-10-15 19:17:36 +04:00
|
|
|
# ::
|
|
|
|
#
|
|
|
|
# JASPER_FOUND - system has Jasper
|
|
|
|
# JASPER_INCLUDE_DIR - the Jasper include directory
|
|
|
|
# JASPER_LIBRARIES - the libraries needed to use Jasper
|
|
|
|
# JASPER_VERSION_STRING - the version of Jasper found (since CMake 2.8.8)
|
2006-09-20 00:11:53 +04:00
|
|
|
|
2012-08-13 21:47:32 +04:00
|
|
|
find_path(JASPER_INCLUDE_DIR jasper/jasper.h)
|
2006-09-20 00:11:53 +04:00
|
|
|
|
2012-08-13 21:47:32 +04:00
|
|
|
if (NOT JASPER_LIBRARIES)
|
|
|
|
find_package(JPEG)
|
2012-01-22 14:15:24 +04:00
|
|
|
|
2012-08-13 21:47:32 +04:00
|
|
|
find_library(JASPER_LIBRARY_RELEASE NAMES jasper libjasper)
|
|
|
|
find_library(JASPER_LIBRARY_DEBUG NAMES jasperd)
|
2012-01-22 14:15:24 +04:00
|
|
|
|
2012-08-13 21:47:32 +04:00
|
|
|
include(${CMAKE_CURRENT_LIST_DIR}/SelectLibraryConfigurations.cmake)
|
2012-01-22 14:15:24 +04:00
|
|
|
SELECT_LIBRARY_CONFIGURATIONS(JASPER)
|
2012-08-13 21:50:14 +04:00
|
|
|
endif ()
|
2006-09-20 00:11:53 +04:00
|
|
|
|
2012-08-13 21:47:32 +04:00
|
|
|
if (JASPER_INCLUDE_DIR AND EXISTS "${JASPER_INCLUDE_DIR}/jasper/jas_config.h")
|
|
|
|
file(STRINGS "${JASPER_INCLUDE_DIR}/jasper/jas_config.h" jasper_version_str REGEX "^#define[\t ]+JAS_VERSION[\t ]+\".*\".*")
|
2012-01-22 16:09:33 +04:00
|
|
|
|
2012-08-13 21:47:32 +04:00
|
|
|
string(REGEX REPLACE "^#define[\t ]+JAS_VERSION[\t ]+\"([^\"]+)\".*" "\\1" JASPER_VERSION_STRING "${jasper_version_str}")
|
2012-08-13 21:50:14 +04:00
|
|
|
endif ()
|
2012-01-22 16:09:33 +04:00
|
|
|
|
2012-08-13 21:42:58 +04:00
|
|
|
# handle the QUIETLY and REQUIRED arguments and set JASPER_FOUND to TRUE if
|
2007-07-18 21:56:45 +04:00
|
|
|
# all listed variables are TRUE
|
2012-08-13 21:47:32 +04:00
|
|
|
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
|
2012-01-22 16:09:33 +04:00
|
|
|
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Jasper
|
|
|
|
REQUIRED_VARS JASPER_LIBRARIES JASPER_INCLUDE_DIR JPEG_LIBRARIES
|
|
|
|
VERSION_VAR JASPER_VERSION_STRING)
|
2006-09-20 00:11:53 +04:00
|
|
|
|
2012-08-13 21:47:32 +04:00
|
|
|
if (JASPER_FOUND)
|
|
|
|
set(JASPER_LIBRARIES ${JASPER_LIBRARIES} ${JPEG_LIBRARIES} )
|
2012-08-13 21:50:14 +04:00
|
|
|
endif ()
|
2006-09-20 00:11:53 +04:00
|
|
|
|
2012-08-13 21:47:32 +04:00
|
|
|
mark_as_advanced(JASPER_INCLUDE_DIR)
|