cmake: add the custom LibRaw module

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2022-10-11 19:43:41 +03:00
parent 7a137a6a9f
commit cdd26390b0
2 changed files with 40 additions and 0 deletions

View file

@ -15,6 +15,7 @@ set(cmakeFilesDontInstall
FindDevinfo.cmake
FindFFmpeg.cmake
FindSpeechd.cmake
FindLibRaw.cmake
)
# Explicitly list all files which will be installed.

View file

@ -0,0 +1,39 @@
# Try to find LibRaw library, once done this will define:
#
# LIBRAW_FOUND - system has LibRaw
# LIBRAW_INCLUDE_DIR - the LibRaw include directory
# LIBRAW_LIBRARIES - the libraries needed to use LibRaw
# LIBRAW_DEFINITIONS - compiler switches required for using LibRaw
#
# Copyright (c) 2020 Ivailo Monev <xakepa10@gmail.com>
#
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
find_package(PkgConfig REQUIRED)
pkg_check_modules(PC_LIBRAW QUIET libraw_r)
set(LIBRAW_INCLUDE_DIR ${PC_LIBRAW_INCLUDE_DIRS})
set(LIBRAW_LIBRARIES ${PC_LIBRAW_LIBRARIES})
set(LIBRAW_VERSION ${PC_LIBRAW_VERSION})
set(LIBRAW_DEFINITIONS ${PC_LIBRAW_CFLAGS_OTHER})
if(NOT LIBRAW_INCLUDE_DIR OR NOT LIBRAW_LIBRARIES)
find_path(LIBRAW_INCLUDE_DIR
NAMES libraw/libraw.h
HINTS $ENV{LIBRAWDIR}/include
)
find_library(LIBRAW_LIBRARIES
NAMES raw_r
HINTS $ENV{LIBRAWDIR}/lib
)
endif()
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(LibRaw
VERSION_VAR LIBRAW_VERSION
REQUIRED_VARS LIBRAW_LIBRARIES LIBRAW_INCLUDE_DIR
)
mark_as_advanced(LIBRAW_INCLUDE_DIR LIBRAW_LIBRARIES)