Blob Blame History Raw
From f97c06cda55195d783c3a852018758558247230e Mon Sep 17 00:00:00 2001
From: Jan Grulich <jgrulich@redhat.com>
Date: Thu, 29 Mar 2018 08:53:09 +0200
Subject: [PATCH 7/8] Require NM 1.0.0 and newer

---
 CMakeLists.txt                 |  2 +-
 cmake/FindNetworkManager.cmake | 23 +++++++----------------
 2 files changed, 8 insertions(+), 17 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 7e4e8e22..e55ecaa0 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -40,7 +40,7 @@ set_package_properties(KF5ModemManagerQt PROPERTIES
                        TYPE OPTIONAL)
 
 # Required only for getting information about NetworkManager version in CMake
-find_package(NetworkManager 0.9.8.4)
+find_package(NetworkManager 1.0.0)
 set_package_properties(NetworkManager PROPERTIES
                        TYPE REQUIRED)
 
diff --git a/cmake/FindNetworkManager.cmake b/cmake/FindNetworkManager.cmake
index fa47037f..e5f114db 100644
--- a/cmake/FindNetworkManager.cmake
+++ b/cmake/FindNetworkManager.cmake
@@ -9,7 +9,7 @@
 
 # Copyright (c) 2006, Alexander Neundorf, <neundorf@kde.org>
 # Copyright (c) 2007, Will Stephenson, <wstephenson@kde.org>
-# Copyright (c) 2015, Jan Grulich, <jgrulich@redhat.com>
+# Copyright (c) 2015-2018, Jan Grulich, <jgrulich@redhat.com>
 
 # Redistribution and use in source and binary forms, with or without
 # modification, are permitted provided that the following conditions
@@ -36,31 +36,22 @@
 # SUCH DAMAGE.
 
 
-IF (NETWORKMANAGER_INCLUDE_DIRS AND NM-CORE_INCLUDE_DIRS)
+IF (NETWORKMANAGER_INCLUDE_DIRS)
     # in cache already
     SET(NetworkManager_FIND_QUIETLY TRUE)
-ENDIF (NETWORKMANAGER_INCLUDE_DIRS AND NM-CORE_INCLUDE_DIRS)
+ENDIF (NETWORKMANAGER_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( NETWORKMANAGER NetworkManager )
-
+    PKG_SEARCH_MODULE(NETWORKMANAGER libnm)
     IF (NETWORKMANAGER_FOUND)
         IF (NetworkManager_FIND_VERSION AND ("${NETWORKMANAGER_VERSION}" VERSION_LESS "${NetworkManager_FIND_VERSION}"))
             MESSAGE(FATAL_ERROR "NetworkManager ${NETWORKMANAGER_VERSION} is too old, need at least ${NetworkManager_FIND_VERSION}")
         ELSE ()
-            # Since NetworkManager 1.0.0 we need to find different libraries
-            IF (NetworkManager_FIND_VERSION AND ("${NETWORKMANAGER_VERSION}" VERSION_GREATER "1.0.0" OR "${NETWORKMANAGER_VERSION}" VERSION_EQUAL "1.0.0"))
-                PKG_SEARCH_MODULE( NM-CORE libnm )
-                IF (NM-CORE_FOUND)
-                    IF (NOT NetworkManager_FIND_QUIETLY)
-                        MESSAGE(STATUS "Found libnm-core: ${NM-CORE_LIBRARY_DIRS}")
-                    ENDIF ()
-                ELSE ()
-                    MESSAGE(FATAL_ERROR "Could NOT find libnm-core, check FindPkgConfig output above!")
-                ENDIF ()
+            IF (NOT NetworkManager_FIND_QUIETLY)
+                MESSAGE(STATUS "Found NetworkManager: ${NETWORKMANAGER_LIBRARY_DIRS}")
             ENDIF ()
         ENDIF ()
     ELSE ()
@@ -68,5 +59,5 @@ IF (NOT WIN32)
     ENDIF ()
 ENDIF (NOT WIN32)
 
-MARK_AS_ADVANCED(NETWORKMANAGER_INCLUDE_DIRS NM-UTIL_INCLUDE_DIRS NM-GLIB_INCLUDE_DIRS NM-CORE_INCLUDE_DIRS)
+MARK_AS_ADVANCED(NETWORKMANAGER_INCLUDE_DIRS)
 
-- 
2.17.0