CMake: test for the presence of libiw

This commit is contained in:
Matteo Cypriani 2013-05-22 17:13:24 -04:00
parent c667203c45
commit 1a30b90683
3 changed files with 31 additions and 1 deletions

View File

@ -56,7 +56,6 @@ Work to do in OwlPS
- Add option dump-configuration (displays the config & exits).
- CMake:
- check dependencies to external libraries
- handle doc/
- generate Positioner's doc out of the source tree
- use the installation prefix as search prefix for configuration files

View File

@ -0,0 +1,17 @@
# This module tries to find the iwlib library (from the Wireless Tools)
# and sets the following variables:
# IWLIB_INCLUDE_DIR
# IWLIB_LIBRARY
# IWLIB_FOUND
# Search for the header file
find_path(IWLIB_INCLUDE_DIR iwlib.h
PATH_SUFFIXES include)
# Search for the library
find_library(IWLIB_LIBRARY iw
PATH_SUFFIXES lib)
# Did we find everything we need?
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Iwlib DEFAULT_MSG
IWLIB_LIBRARY IWLIB_INCLUDE_DIR)

View File

@ -53,6 +53,20 @@ if (OWLPS_LISTENER_USES_PTHREAD)
endif()
endif()
# Check if iwlib is available
find_package(Iwlib)
if (OWLPS_LISTENER_KEEPS_MONITOR)
if (IWLIB_FOUND)
include_directories(${IWLIB_INCLUDE_DIR})
set(EXTRA_LIBS ${EXTRA_LIBS} ${IWLIB_LIBRARY})
else()
message(WARNING
"iwlib is not available: disabling OWLPS_LISTENER_KEEPS_MONITOR")
set(OWLPS_LISTENER_KEEPS_MONITOR off CACHE BOOL
"No iwlib: disable OWLPS_LISTENER_KEEPS_MONITOR" FORCE)
endif()
endif()
### Targets ###