2016-09-27 19:01:08 +00: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 15:17:36 +00:00
|
|
|
#.rst:
|
|
|
|
# FindJasper
|
|
|
|
# ----------
|
|
|
|
#
|
|
|
|
# Try to find the Jasper JPEG2000 library
|
|
|
|
#
|
2006-09-19 20:11:53 +00:00
|
|
|
# Once done this will define
|
|
|
|
#
|
2013-10-15 15:17:36 +00: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-19 20:11:53 +00:00
|
|
|
|
2012-08-13 17:47:32 +00:00
|
|
|
find_path(JASPER_INCLUDE_DIR jasper/jasper.h)
|
2006-09-19 20:11:53 +00:00
|
|
|
|
2012-08-13 17:47:32 +00:00
|
|
|
if (NOT JASPER_LIBRARIES)
|
|
|
|
find_package(JPEG)
|
2012-01-22 10:15:24 +00:00
|
|
|
|
2012-08-13 17:47:32 +00:00
|
|
|
find_library(JASPER_LIBRARY_RELEASE NAMES jasper libjasper)
|
|
|
|
find_library(JASPER_LIBRARY_DEBUG NAMES jasperd)
|
2012-01-22 10:15:24 +00:00
|
|
|
|
2012-08-13 17:47:32 +00:00
|
|
|
include(${CMAKE_CURRENT_LIST_DIR}/SelectLibraryConfigurations.cmake)
|
2012-01-22 10:15:24 +00:00
|
|
|
SELECT_LIBRARY_CONFIGURATIONS(JASPER)
|
2012-08-13 17:50:14 +00:00
|
|
|
endif ()
|
2006-09-19 20:11:53 +00:00
|
|
|
|
2012-08-13 17:47:32 +00: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 12:09:33 +00:00
|
|
|
|
2012-08-13 17:47:32 +00:00
|
|
|
string(REGEX REPLACE "^#define[\t ]+JAS_VERSION[\t ]+\"([^\"]+)\".*" "\\1" JASPER_VERSION_STRING "${jasper_version_str}")
|
2012-08-13 17:50:14 +00:00
|
|
|
endif ()
|
2012-01-22 12:09:33 +00:00
|
|
|
|
2012-08-13 17:47:32 +00:00
|
|
|
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
|
2012-01-22 12:09:33 +00:00
|
|
|
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Jasper
|
|
|
|
REQUIRED_VARS JASPER_LIBRARIES JASPER_INCLUDE_DIR JPEG_LIBRARIES
|
|
|
|
VERSION_VAR JASPER_VERSION_STRING)
|
2006-09-19 20:11:53 +00:00
|
|
|
|
2012-08-13 17:47:32 +00:00
|
|
|
if (JASPER_FOUND)
|
|
|
|
set(JASPER_LIBRARIES ${JASPER_LIBRARIES} ${JPEG_LIBRARIES} )
|
2012-08-13 17:50:14 +00:00
|
|
|
endif ()
|
2006-09-19 20:11:53 +00:00
|
|
|
|
2012-08-13 17:47:32 +00:00
|
|
|
mark_as_advanced(JASPER_INCLUDE_DIR)
|