1 # - Try to find the libmtp library
2 # Once done this will define
4 # MTP_FOUND - system has libmtp
5 # MTP_INCLUDE_DIR - the libmtp include directory
6 # MTP_LIBRARIES - Link these to use libmtp
7 # MTP_DEFINITIONS - Compiler switches required for using libmtp
10 if (MTP_INCLUDE_DIR AND MTP_LIBRARIES AND MTP_VERSION_OKAY)
15 else (MTP_INCLUDE_DIR AND MTP_LIBRARIES AND MTP_VERSION_OKAY)
17 # use pkg-config to get the directories and then use these values
18 # in the FIND_PATH() and FIND_LIBRARY() calls
21 PKGCONFIG(libmtp _MTPIncDir _MTPLinkDir _MTPLinkFlags _MTPCflags)
23 set(MTP_DEFINITIONS ${_MTPCflags})
25 FIND_PATH(MTP_INCLUDE_DIR libmtp.h
31 FIND_LIBRARY(MTP_LIBRARIES NAMES mtp
38 exec_program(${PKGCONFIG_EXECUTABLE} ARGS --atleast-version=0.1.1 libmtp OUTPUT_VARIABLE _pkgconfigDevNull RETURN_VALUE MTP_VERSION_OKAY)
40 if (MTP_INCLUDE_DIR AND MTP_LIBRARIES AND MTP_VERSION_OKAY STREQUAL "0")
42 endif (MTP_INCLUDE_DIR AND MTP_LIBRARIES AND MTP_VERSION_OKAY STREQUAL "0")
45 if (NOT Mtp_FIND_QUIETLY)
46 message(STATUS "Found MTP: ${MTP_LIBRARIES}")
47 endif (NOT Mtp_FIND_QUIETLY)
49 if (MTP_INCLUDE_DIR AND MTP_LIBRARIES AND NOT MTP_VERSION_OKAY STREQUAL "0")
50 message(STATUS "Found MTP but version requirements not met")
51 endif (MTP_INCLUDE_DIR AND MTP_LIBRARIES AND NOT MTP_VERSION_OKAY STREQUAL "0")
52 if (Mtp_FIND_REQUIRED)
53 message(FATAL_ERROR "Could NOT find MTP")
54 endif (Mtp_FIND_REQUIRED)
57 MARK_AS_ADVANCED(MTP_INCLUDE_DIR MTP_LIBRARIES)
59 endif (MTP_INCLUDE_DIR AND MTP_LIBRARIES AND MTP_VERSION_OKAY)