Commit 63ec8029 authored by Jan Grulich's avatar Jan Grulich
Browse files

Improve searching for ModemManager and NetworkManager

parent fba7187a
......@@ -6,10 +6,6 @@ set(QT_MIN_VERSION "5.2.0")
set(PLASMA_NM_VERSION 1.0.0)
set(PLASMA_NM_STRING_VERSION "${PLASMA_NM_VERSION}")
# With CMake older than version 3.1 pkg_check_modules ignores CMAKE_PREFIX_PATH
set(PKG_CONFIG_USE_CMAKE_PREFIX_PATH ON)
include(FindPkgConfig)
################# set KDE specific information #################
find_package(ECM 0.0.12 REQUIRED NO_MODULE)
......@@ -18,12 +14,10 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_D
include(KDEInstallDirs)
include(KDECMakeSettings)
include(KDECompilerSettings)
include(CMakePackageConfigHelpers)
include(FeatureSummary)
include(WriteBasicConfigVersionFile)
include(ECMOptionalAddSubdirectory)
pkg_check_modules(NETWORKMANAGER REQUIRED NetworkManager)
include(ECMPackageConfigHelpers)
include(ECMOptionalAddSubdirectory)
include(FeatureSummary)
find_package(Qt5 ${QT_MIN_VERSION} CONFIG REQUIRED COMPONENTS
Core
......@@ -47,6 +41,14 @@ find_package(KF5ModemManagerQt)
set_package_properties(KF5ModemManagerQt PROPERTIES
TYPE OPTIONAL)
find_package(NetworkManager)
set_package_properties(NetworkManager PROPERTIES
TYPE REQUIRED)
find_package(ModemManager)
set_package_properties(ModemManager PROPERTIES
TYPE OPTIONAL)
find_package(MobileBroadbandProviderInfo)
set_package_properties(MobileBroadbandProviderInfo PROPERTIES
DESCRIPTION "Database of mobile broadband service providers"
......@@ -57,11 +59,11 @@ if (DISABLE_MODEMMANAGER_SUPPORT)
message(STATUS "Disabling ModemManager support")
set(WITH_MODEMMANAGER_SUPPORT 0)
else()
if (KF5ModemManagerQt_FOUND)
if (KF5ModemManagerQt_FOUND AND ModemManager_FOUND)
message(STATUS "Enabling ModemManager support")
set(WITH_MODEMMANAGER_SUPPORT 1)
else()
message(STATUS "ModemManagerQt not found")
message(STATUS "ModemManager or ModemManagerQt not found")
set(WITH_MODEMMANAGER_SUPPORT 0)
endif()
endif()
......@@ -81,7 +83,6 @@ include_directories(${CMAKE_CURRENT_BINARY_DIR} # for config.h
${NETWORKMANAGER_INCLUDE_DIRS})
if (WITH_MODEMMANAGER_SUPPORT)
pkg_check_modules(MODEMMANAGER REQUIRED ModemManager>=1.0)
include_directories(${MODEMMANAGER_INCLUDE_DIRS})
endif()
......
# - Try to find ModemManager
# Once done this will define
#
# MODEMMANAGER_FOUND - system has ModemManager
# MODEMMANAGER_INCLUDE_DIRS - the ModemManager include directories
# MODEMMANAGER_LIBRARIES - the libraries needed to use ModemManager
# MODEMMANAGER_CFLAGS - Compiler switches required for using ModemManager
# MODEMMANAGER_VERSION - version number of ModemManager
# Copyright (c) 2006, Alexander Neundorf, <neundorf@kde.org>
# Copyright (c) 2007, Will Stephenson, <wstephenson@kde.org>
#
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
IF (MODEMMANAGER_INCLUDE_DIRS)
# in cache already
SET(ModemManager_FIND_QUIETLY TRUE)
ENDIF (MODEMMANAGER_INCLUDE_DIRS)
IF (NOT WIN32)
# use pkg-config to get the directories and then use these values
# in the FIND_PATH() and FIND_LIBRARY() calls
find_package(PkgConfig)
PKG_SEARCH_MODULE( MODEMMANAGER ModemManager )
ENDIF (NOT WIN32)
IF (MODEMMANAGER_FOUND)
IF (ModemManager_FIND_VERSION AND ("${MODEMMANAGER_VERSION}" VERSION_LESS "${ModemManager_FIND_VERSION}"))
MESSAGE(FATAL_ERROR "ModemManager ${MODEMMANAGER_VERSION} is too old, need at least ${ModemManager_FIND_VERSION}")
ELSEIF (NOT ModemManager_FIND_QUIETLY)
MESSAGE(STATUS "Found ModemManager ${MODEMMANAGER_VERSION}: ${MODEMMANAGER_LIBRARY_DIRS}")
ENDIF()
ELSE (MODEMMANAGER_FOUND)
IF (ModemManager_FIND_REQUIRED)
MESSAGE(FATAL_ERROR "Could NOT find ModemManager, check FindPkgConfig output above!")
ENDIF (ModemManager_FIND_REQUIRED)
ENDIF (MODEMMANAGER_FOUND)
MARK_AS_ADVANCED(MODEMMANAGER_INCLUDE_DIRS NM-UTIL_INCLUDE_DIRS)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment