mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2025-10-24 03:57:39 +00:00
Uniformize style of CMake modules
This commit is contained in:
@@ -45,8 +45,8 @@
|
||||
# PCAP_FOUND - True if pcap found.
|
||||
|
||||
|
||||
IF(EXISTS $ENV{PCAPDIR})
|
||||
FIND_PATH(PCAP_INCLUDE_DIR
|
||||
if(EXISTS $ENV{PCAPDIR})
|
||||
find_path(PCAP_INCLUDE_DIR
|
||||
NAMES
|
||||
pcap/pcap.h
|
||||
pcap.h
|
||||
@@ -54,68 +54,60 @@ IF(EXISTS $ENV{PCAPDIR})
|
||||
$ENV{PCAPDIR}
|
||||
NO_DEFAULT_PATH
|
||||
)
|
||||
|
||||
FIND_LIBRARY(PCAP_LIBRARY
|
||||
find_library(PCAP_LIBRARY
|
||||
NAMES
|
||||
pcap
|
||||
PATHS
|
||||
$ENV{PCAPDIR}
|
||||
NO_DEFAULT_PATH
|
||||
)
|
||||
|
||||
|
||||
ELSE(EXISTS $ENV{PCAPDIR})
|
||||
FIND_PATH(PCAP_INCLUDE_DIR
|
||||
else()
|
||||
find_path(PCAP_INCLUDE_DIR
|
||||
NAMES
|
||||
pcap/pcap.h
|
||||
pcap.h
|
||||
)
|
||||
|
||||
FIND_LIBRARY(PCAP_LIBRARY
|
||||
find_library(PCAP_LIBRARY
|
||||
NAMES
|
||||
pcap
|
||||
)
|
||||
endif()
|
||||
|
||||
ENDIF(EXISTS $ENV{PCAPDIR})
|
||||
set(PCAP_INCLUDE_DIRS ${PCAP_INCLUDE_DIR})
|
||||
set(PCAP_LIBRARIES ${PCAP_LIBRARY})
|
||||
|
||||
SET(PCAP_INCLUDE_DIRS ${PCAP_INCLUDE_DIR})
|
||||
SET(PCAP_LIBRARIES ${PCAP_LIBRARY})
|
||||
if(PCAP_INCLUDE_DIRS)
|
||||
message(STATUS "Pcap include dirs set to ${PCAP_INCLUDE_DIRS}")
|
||||
else()
|
||||
message(FATAL " Pcap include dirs cannot be found")
|
||||
endif()
|
||||
|
||||
IF(PCAP_INCLUDE_DIRS)
|
||||
MESSAGE(STATUS "Pcap include dirs set to ${PCAP_INCLUDE_DIRS}")
|
||||
ELSE(PCAP_INCLUDE_DIRS)
|
||||
MESSAGE(FATAL " Pcap include dirs cannot be found")
|
||||
ENDIF(PCAP_INCLUDE_DIRS)
|
||||
|
||||
IF(PCAP_LIBRARIES)
|
||||
MESSAGE(STATUS "Pcap library set to ${PCAP_LIBRARIES}")
|
||||
ELSE(PCAP_LIBRARIES)
|
||||
MESSAGE(FATAL "Pcap library cannot be found")
|
||||
ENDIF(PCAP_LIBRARIES)
|
||||
if(PCAP_LIBRARIES)
|
||||
message(STATUS "Pcap library set to ${PCAP_LIBRARIES}")
|
||||
else()
|
||||
message(FATAL "Pcap library cannot be found")
|
||||
endif()
|
||||
|
||||
#Functions
|
||||
INCLUDE(CheckFunctionExists)
|
||||
SET(CMAKE_REQUIRED_INCLUDES ${PCAP_INCLUDE_DIRS})
|
||||
SET(CMAKE_REQUIRED_LIBRARIES ${PCAP_LIBRARIES})
|
||||
CHECK_FUNCTION_EXISTS("pcap_breakloop" HAVE_PCAP_BREAKLOOP)
|
||||
CHECK_FUNCTION_EXISTS("pcap_datalink_name_to_val" HAVE_PCAP_DATALINK_NAME_TO_VAL)
|
||||
CHECK_FUNCTION_EXISTS("pcap_datalink_val_to_name" HAVE_PCAP_DATALINK_VAL_TO_NAME)
|
||||
CHECK_FUNCTION_EXISTS("pcap_findalldevs" HAVE_PCAP_FINDALLDEVS)
|
||||
CHECK_FUNCTION_EXISTS("pcap_freecode" HAVE_PCAP_FREECODE)
|
||||
CHECK_FUNCTION_EXISTS("pcap_get_selectable_fd" HAVE_PCAP_GET_SELECTABLE_FD)
|
||||
CHECK_FUNCTION_EXISTS("pcap_lib_version" HAVE_PCAP_LIB_VERSION)
|
||||
CHECK_FUNCTION_EXISTS("pcap_list_datalinks" HAVE_PCAP_LIST_DATALINKS)
|
||||
CHECK_FUNCTION_EXISTS("pcap_open_dead" HAVE_PCAP_OPEN_DEAD)
|
||||
CHECK_FUNCTION_EXISTS("pcap_set_datalink" HAVE_PCAP_SET_DATALINK)
|
||||
include(CheckFunctionExists)
|
||||
set(CMAKE_REQUIRED_INCLUDES ${PCAP_INCLUDE_DIRS})
|
||||
set(CMAKE_REQUIRED_LIBRARIES ${PCAP_LIBRARIES})
|
||||
check_function_exists("pcap_breakloop" HAVE_PCAP_BREAKLOOP)
|
||||
check_function_exists("pcap_datalink_name_to_val" HAVE_PCAP_DATALINK_NAME_TO_VAL)
|
||||
check_function_exists("pcap_datalink_val_to_name" HAVE_PCAP_DATALINK_VAL_TO_NAME)
|
||||
check_function_exists("pcap_findalldevs" HAVE_PCAP_FINDALLDEVS)
|
||||
check_function_exists("pcap_freecode" HAVE_PCAP_FREECODE)
|
||||
check_function_exists("pcap_get_selectable_fd" HAVE_PCAP_GET_SELECTABLE_FD)
|
||||
check_function_exists("pcap_lib_version" HAVE_PCAP_LIB_VERSION)
|
||||
check_function_exists("pcap_list_datalinks" HAVE_PCAP_LIST_DATALINKS)
|
||||
check_function_exists("pcap_open_dead" HAVE_PCAP_OPEN_DEAD)
|
||||
check_function_exists("pcap_set_datalink" HAVE_PCAP_SET_DATALINK)
|
||||
|
||||
|
||||
#Is pcap found ?
|
||||
IF(PCAP_INCLUDE_DIRS AND PCAP_LIBRARIES)
|
||||
SET( PCAP_FOUND true )
|
||||
ENDIF(PCAP_INCLUDE_DIRS AND PCAP_LIBRARIES)
|
||||
|
||||
|
||||
MARK_AS_ADVANCED(
|
||||
mark_as_advanced(
|
||||
PCAP_LIBRARIES
|
||||
PCAP_INCLUDE_DIRS
|
||||
)
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(PCAP DEFAULT_MSG PCAP_INCLUDE_DIRS PCAP_LIBRARIES)
|
||||
|
||||
Reference in New Issue
Block a user