2 # Eventually replace with Jasper's actual config if using that
3 # Once found this file will define:
4 # Jasper_FOUND - System has Jasper
5 # Jasper_INCLUDE_DIRS - The Jasper include directories
6 # Jasper_LIBRARIES - The libraries needed to use Jasper
8 find_package( PkgConfig )
9 pkg_check_modules( PC_Jasper QUIET Jasper )
10 # set(CMAKE_FIND_DEBUG_MODE TRUE)
13 NAMES jasper/jasper.h # Make it so we go up one dir
15 HINTS ${Jasper_ROOT} ${JASPERINC} ${JASPER_PATH} ENV Jasper_ROOT ENV JASPERINC ENV JASPER_PATH
16 PATHS ${PC_Jasper_INCLUDE_DIRS}
17 PATH_SUFFIXES Jasper jasper include #include/jasper
23 HINTS ${Jasper_ROOT} ${JASPERLIB} ${JASPER_PATH} ENV Jasper_ROOT ENV JASPERLIB ENV JASPER_PATH
24 PATHS ${PC_Jasper_LIBRARY_DIRS}
28 # Ripped from https://github.com/Kitware/CMake/blob/master/Modules/FindJasper.cmake
29 if( Jasper_INCLUDE_DIR AND EXISTS "${Jasper_INCLUDE_DIR}/jasper/jas_config.h")
30 file(STRINGS "${Jasper_INCLUDE_DIR}/jasper/jas_config.h" jasper_version_str REGEX "^#define[\t ]+JAS_VERSION[\t ]+\".*\".*")
31 string(REGEX REPLACE "^#define[\t ]+JAS_VERSION[\t ]+\"([^\"]+)\".*" "\\1" Jasper_VERSION_STRING "${jasper_version_str}")
33 # set(CMAKE_FIND_DEBUG_MODE FALSE)
35 include(FindPackageHandleStandardArgs)
36 find_package_handle_standard_args(
38 FOUND_VAR Jasper_FOUND
42 VERSION_VAR Jasper_VERSION_STRING
46 if ( Jasper_FOUND AND NOT TARGET Jasper::Jasper )
47 add_library( Jasper::Jasper UNKNOWN IMPORTED )
48 set_target_properties(
51 IMPORTED_LOCATION "${Jasper_LIBRARY}"
52 INTERFACE_COMPILE_OPTIONS "${PC_Jasper_CFLAGS_OTHER}"
53 INTERFACE_INCLUDE_DIRECTORIES "${Jasper_INCLUDE_DIR}"
56 # Allow traditional/legacy style usage
57 set( Jasper_LIBRARIES ${Jasper_LIBRARY} )
58 set( Jasper_INCLUDE_DIRS ${Jasper_INCLUDE_DIR} )
59 set( Jasper_DEFINITIONS ${PC_Jasper_CFLAGS_OTHER} )