diff --git a/CMakeLists.txt b/CMakeLists.txt index 60172b0d..1dfe6e8a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -55,18 +55,33 @@ set_package_properties(BISON PROPERTIES PURPOSE "Required for the Predicate parser" ) -find_package(IMobileDevice) -set_package_properties(IMobileDevice PROPERTIES +find_package(unofficial-libimobiledevice CONFIG) +set_package_properties(unofficial-libimobiledevice PROPERTIES TYPE OPTIONAL PURPOSE "Needed to build the iOS device support backend" ) -find_package(PList) -set_package_properties(PList PROPERTIES +find_package(unofficial-libplist CONFIG) +set_package_properties(unofficial-libplist PROPERTIES TYPE OPTIONAL PURPOSE "Needed to build the iOS device support backend" ) +set(HAVE_IMOBILE OFF) +if(TARGET unofficial::libimobiledevice::libimobiledevice AND TARGET unofficial::libplist::libplist) + set(HAVE_IMOBILE ON) + set(IMobileDevice_VERSION "1.3.0") + set(_imobile_version "0x00000") + if (IMobileDevice_VERSION VERSION_GREATER_EQUAL 1.3.0) + set(_imobile_version "0x10300") + elseif(IMobileDevice_VERSION VERSION_GREATER_EQUAL 1.2.0) + set(_imobile_version "0x10200") + endif() + set_target_properties(unofficial::libimobiledevice::libimobiledevice PROPERTIES + INTERFACE_COMPILE_DEFINITIONS "IMOBILEDEVICE_API=${_imobile_version}" + ) +endif() + # Used by the UDisks backend on Linux find_package(LibMount) set_package_properties(LibMount PROPERTIES @@ -138,7 +153,7 @@ elseif (NOT ANDROID) endif() endif() -if(IMobileDevice_FOUND AND PList_FOUND) +if(HAVE_IMOBILE) add_device_backend(imobile) endif() diff --git a/KF5SolidConfig.cmake.in b/KF5SolidConfig.cmake.in index 6fc15eeb..a6250ce6 100644 --- a/KF5SolidConfig.cmake.in +++ b/KF5SolidConfig.cmake.in @@ -27,6 +27,11 @@ if (NOT @BUILD_SHARED_LIBS@) find_dependency(LibMount) endif() + if (@HAVE_IMOBILE@) + find_dependency(unofficial-libimobiledevice) + find_dependency(unofficial-libplist) + endif() + if ("@Qt5DBus_FOUND@" OR "@Qt6DBus_FOUND@") find_dependency(Qt@QT_MAJOR_VERSION@DBus @REQUIRED_QT_VERSION@) endif() diff --git a/src/solid/devices/backends/imobile/CMakeLists.txt b/src/solid/devices/backends/imobile/CMakeLists.txt index e1666447..3f8b982e 100644 --- a/src/solid/devices/backends/imobile/CMakeLists.txt +++ b/src/solid/devices/backends/imobile/CMakeLists.txt @@ -5,7 +5,7 @@ set(backend_sources imobiledeviceinterface.cpp imobileportablemediaplayer.cpp ) -set(backend_libs IMobileDevice::IMobileDevice PList::PList) +set(backend_libs unofficial::libimobiledevice::libimobiledevice unofficial::libplist::libplist) ecm_qt_declare_logging_category(backend_sources HEADER imobile_debug.h