From 1915ce613387c135ae8e3bc55190e3e7473313d2 Mon Sep 17 00:00:00 2001 From: Gerald Combs Date: Mon, 12 Mar 2018 13:40:56 -0700 Subject: [PATCH] CMake: Skip some header checks on Windows. Skip some header checks on Windows when we're sure they will always be true. Change-Id: I4ff7c867b9268a53692085553055dcbc0f90ae1d Reviewed-on: https://code.wireshark.org/review/26452 Reviewed-by: Gerald Combs Petri-Dish: Gerald Combs Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman --- ConfigureChecks.cmake | 8 ++++++++ cmake/modules/FindPCAP.cmake | 22 +++++++++++++++++++++- 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/ConfigureChecks.cmake b/ConfigureChecks.cmake index 1e7a75ae55..0a6c1fc065 100644 --- a/ConfigureChecks.cmake +++ b/ConfigureChecks.cmake @@ -9,6 +9,14 @@ include(CMakePushCheckState) +if(WIN32) + # Prepopulate some values. Compilation checks on Windows can be slow. + set(HAVE_FCNTL_H TRUE) + set(HAVE_SYS_STAT_H TRUE) + set(HAVE_FLOORL TRUE) + set(HAVE_LRINT TRUE) +endif(WIN32) + #check system for includes include(CheckIncludeFile) check_include_file("arpa/inet.h" HAVE_ARPA_INET_H) diff --git a/cmake/modules/FindPCAP.cmake b/cmake/modules/FindPCAP.cmake index 469a8347ac..c963e19ae0 100644 --- a/cmake/modules/FindPCAP.cmake +++ b/cmake/modules/FindPCAP.cmake @@ -53,6 +53,26 @@ if( PCAP_FOUND ) set( CMAKE_REQUIRED_INCLUDES ${PCAP_INCLUDE_DIRS} ) set( CMAKE_REQUIRED_LIBRARIES ${PCAP_LIBRARIES} ) + if(WIN32) + # Prepopulate some values. WinPcap and NPcap always have these and + # compilation checks on Windows can be slow. + set(HAVE_PCAP_OPEN_DEAD TRUE) + set(HAVE_PCAP_FREECODE TRUE) + set(HAVE_PCAP_BREAKLOOP TRUE) + set(HAVE_PCAP_CREATE TRUE) + set(HAVE_PCAP_DATALINK_NAME_TO_VAL TRUE) + set(HAVE_PCAP_DATALINK_VAL_TO_DESCRIPTION TRUE) + set(HAVE_PCAP_DATALINK_VAL_TO_NAME TRUE) + set(HAVE_PCAP_FINDALLDEVS TRUE) + set(HAVE_PCAP_FREE_DATALINKS TRUE) + set(HAVE_PCAP_LIB_VERSION TRUE) + set(HAVE_PCAP_LIST_DATALINKS TRUE) + set(HAVE_PCAP_SET_DATALINK TRUE) + set(HAVE_BPF_IMAGE TRUE) + set(HAVE_PCAP_OPEN TRUE) + set(HAVE_PCAP_SETSAMPLING TRUE) + endif(WIN32) + check_function_exists( "pcap_open_dead" HAVE_PCAP_OPEN_DEAD ) check_function_exists( "pcap_freecode" HAVE_PCAP_FREECODE ) # @@ -63,7 +83,7 @@ if( PCAP_FOUND ) # check_function_exists( "pcap_breakloop" HAVE_PCAP_BREAKLOOP ) check_function_exists( "pcap_create" HAVE_PCAP_CREATE ) - if( HAVE_PCAP_CREATE OR WIN32 ) + if( HAVE_PCAP_CREATE ) # # If we have pcap_create(), we have pcap_set_buffer_size(), and # can set the capture buffer size.