Changeset View
Changeset View
Standalone View
Standalone View
cmake/modules/FindNetworkManager.cmake
1 | # - Try to find NetworkManager | 1 | # - Try to find NetworkManager | ||
---|---|---|---|---|---|
2 | # Once done this will define | 2 | # Once done this will define | ||
3 | # | 3 | # | ||
4 | # NETWORKMANAGER_FOUND - system has NetworkManager | 4 | # NETWORKMANAGER_FOUND - system has NetworkManager | ||
5 | # NETWORKMANAGER_INCLUDE_DIRS - the NetworkManager include directories | 5 | # NETWORKMANAGER_INCLUDE_DIRS - the NetworkManager include directories | ||
6 | # NETWORKMANAGER_LIBRARIES - the libraries needed to use NetworkManager | 6 | # NETWORKMANAGER_LIBRARIES - the libraries needed to use NetworkManager | ||
7 | # NETWORKMANAGER_CFLAGS - Compiler switches required for using NetworkManager | 7 | # NETWORKMANAGER_CFLAGS - Compiler switches required for using NetworkManager | ||
8 | # NETWORKMANAGER_VERSION - version number of NetworkManager | 8 | # NETWORKMANAGER_VERSION - version number of NetworkManager | ||
9 | 9 | | |||
10 | # Copyright (c) 2006, Alexander Neundorf, <neundorf@kde.org> | 10 | # Copyright (c) 2006, Alexander Neundorf, <neundorf@kde.org> | ||
11 | # Copyright (c) 2007, Will Stephenson, <wstephenson@kde.org> | 11 | # Copyright (c) 2007, Will Stephenson, <wstephenson@kde.org> | ||
12 | # Copyright (c) 2015-2018, Jan Grulich, <jgrulich@redhat.com> | ||||
13 | | ||||
14 | # Redistribution and use in source and binary forms, with or without | ||||
15 | # modification, are permitted provided that the following conditions | ||||
16 | # are met: | ||||
17 | # 1. Redistributions of source code must retain the above copyright | ||||
18 | # notice, this list of conditions and the following disclaimer. | ||||
19 | # 2. Redistributions in binary form must reproduce the above copyright | ||||
20 | # notice, this list of conditions and the following disclaimer in the | ||||
21 | # documentation and/or other materials provided with the distribution. | ||||
22 | # 3. Neither the name of the University nor the names of its contributors | ||||
23 | # may be used to endorse or promote products derived from this software | ||||
24 | # without specific prior written permission. | ||||
12 | # | 25 | # | ||
13 | # Redistribution and use is allowed according to the terms of the BSD license. | 26 | # THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND | ||
14 | # For details see the accompanying COPYING-CMAKE-SCRIPTS file. | 27 | # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
28 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||||
29 | # ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | ||||
30 | # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||||
31 | # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||||
32 | # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||||
33 | # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||||
34 | # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||||
35 | # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||||
36 | # SUCH DAMAGE. | ||||
15 | 37 | | |||
16 | 38 | | |||
17 | IF (NETWORKMANAGER_INCLUDE_DIRS AND NM-UTIL_INCLUDE_DIRS) | 39 | IF (NETWORKMANAGER_INCLUDE_DIRS) | ||
18 | # in cache already | 40 | # in cache already | ||
19 | SET(NetworkManager_FIND_QUIETLY TRUE) | 41 | SET(NetworkManager_FIND_QUIETLY TRUE) | ||
20 | ENDIF (NETWORKMANAGER_INCLUDE_DIRS AND NM-UTIL_INCLUDE_DIRS) | 42 | ENDIF (NETWORKMANAGER_INCLUDE_DIRS) | ||
21 | 43 | | |||
22 | IF (NOT WIN32) | 44 | IF (NOT WIN32) | ||
23 | # use pkg-config to get the directories and then use these values | | |||
24 | # in the FIND_PATH() and FIND_LIBRARY() calls | | |||
25 | find_package(PkgConfig) | 45 | find_package(PkgConfig) | ||
26 | PKG_SEARCH_MODULE( NETWORKMANAGER NetworkManager ) | 46 | PKG_SEARCH_MODULE(NETWORKMANAGER libnm) | ||
27 | PKG_SEARCH_MODULE( NM-UTIL libnm-util ) | 47 | IF (NETWORKMANAGER_FOUND) | ||
28 | ENDIF (NOT WIN32) | 48 | IF (NetworkManager_FIND_VERSION AND ("${NETWORKMANAGER_VERSION}" VERSION_LESS "${NetworkManager_FIND_VERSION}")) | ||
29 | 49 | MESSAGE(FATAL_ERROR "NetworkManager ${NETWORKMANAGER_VERSION} is too old, need at least ${NetworkManager_FIND_VERSION}") | |||
30 | IF (NETWORKMANAGER_FOUND AND NM-UTIL_FOUND) | 50 | ELSE () | ||
31 | IF (NOT NetworkManager_FIND_QUIETLY) | 51 | IF (NOT NetworkManager_FIND_QUIETLY) | ||
32 | MESSAGE(STATUS "Found NetworkManager ${NETWORKMANAGER_VERSION}: ${NETWORKMANAGER_LIBRARY_DIRS}") | 52 | MESSAGE(STATUS "Found NetworkManager: ${NETWORKMANAGER_LIBRARY_DIRS}") | ||
33 | MESSAGE(STATUS "Found libnm-util: ${NM-UTIL_LIBRARY_DIRS}") | 53 | ENDIF () | ||
34 | ENDIF (NOT NetworkManager_FIND_QUIETLY) | 54 | ENDIF () | ||
35 | ELSE (NETWORKMANAGER_FOUND AND NM-UTIL_FOUND) | 55 | ELSE () | ||
36 | IF (NetworkManager_FIND_REQUIRED) | 56 | MESSAGE(FATAL_ERROR "Could NOT find NetworkManager, check FindPkgConfig output above!") | ||
37 | MESSAGE(FATAL_ERROR "Could NOT find NetworkManager or libnm-util, check FindPkgConfig output above!") | 57 | ENDIF () | ||
38 | ENDIF (NetworkManager_FIND_REQUIRED) | 58 | ENDIF (NOT WIN32) | ||
39 | ENDIF (NETWORKMANAGER_FOUND AND NM-UTIL_FOUND) | | |||
40 | | ||||
41 | MARK_AS_ADVANCED(NETWORKMANAGER_INCLUDE_DIRS NM-UTIL_INCLUDE_DIRS) | | |||
42 | 59 | | |||
60 | MARK_AS_ADVANCED(NETWORKMANAGER_INCLUDE_DIRS) |