2021-03-07 02:40:21 +02:00
|
|
|
# Try to find the libmtp library, once done this will define:
|
2015-11-05 10:05:41 +02:00
|
|
|
#
|
|
|
|
# MTP_FOUND - system has libmtp
|
|
|
|
# MTP_INCLUDE_DIR - the libmtp include directory
|
2020-02-21 17:44:22 +00:00
|
|
|
# MTP_LIBRARIES - the libraries needed to use libmtp
|
|
|
|
# MTP_DEFINITIONS - compiler switches required for using libmtp
|
|
|
|
#
|
2021-03-07 02:40:21 +02:00
|
|
|
# Copyright (c) 2020 Ivailo Monev <xakepa10@gmail.com>
|
2015-11-05 10:05:41 +02:00
|
|
|
#
|
2020-02-21 17:44:22 +00:00
|
|
|
# Redistribution and use is allowed according to the terms of the BSD license.
|
|
|
|
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
|
|
|
|
|
2022-10-02 10:46:46 +03:00
|
|
|
find_package(PkgConfig REQUIRED)
|
|
|
|
pkg_check_modules(PC_MTP QUIET libmtp)
|
2020-02-21 17:44:22 +00:00
|
|
|
|
2022-10-02 10:46:46 +03:00
|
|
|
set(MTP_INCLUDE_DIR ${PC_MTP_INCLUDE_DIRS})
|
|
|
|
set(MTP_LIBRARIES ${PC_MTP_LIBRARIES})
|
2020-02-21 17:44:22 +00:00
|
|
|
set(MTP_VERSION ${PC_MTP_VERSION})
|
|
|
|
set(MTP_DEFINITIONS ${PC_MTP_CFLAGS_OTHER})
|
2015-11-05 10:05:41 +02:00
|
|
|
|
2020-02-21 17:44:22 +00:00
|
|
|
if(NOT MTP_INCLUDE_DIR OR NOT MTP_LIBRARIES)
|
|
|
|
find_path(MTP_INCLUDE_DIR
|
|
|
|
NAMES libmtp.h
|
|
|
|
HINTS $ENV{MTPDIR}/include
|
|
|
|
)
|
2015-11-05 10:05:41 +02:00
|
|
|
|
2020-02-21 17:44:22 +00:00
|
|
|
find_library(MTP_LIBRARIES
|
|
|
|
NAMES mtp
|
|
|
|
HINTS $ENV{MTPDIR}/lib
|
|
|
|
)
|
|
|
|
endif()
|
2015-11-05 10:05:41 +02:00
|
|
|
|
2020-02-21 17:44:22 +00:00
|
|
|
include(FindPackageHandleStandardArgs)
|
|
|
|
find_package_handle_standard_args(Mtp
|
|
|
|
VERSION_VAR MTP_VERSION
|
|
|
|
REQUIRED_VARS MTP_LIBRARIES MTP_INCLUDE_DIR
|
|
|
|
)
|
2015-11-05 10:05:41 +02:00
|
|
|
|
2020-02-21 17:44:22 +00:00
|
|
|
mark_as_advanced(MTP_INCLUDE_DIR MTP_LIBRARIES)
|