From a988253fef15e6a0ddd05b0fb06e18ccde00082b Mon Sep 17 00:00:00 2001 From: Gerald Combs Date: Mon, 12 Jan 2015 14:44:42 -0800 Subject: [PATCH] CMake: Copy libwireshark dependent DLLs to the target directory. Add a "copy_cli_dlls" target which copies the DLLs required to run our command line programs to the run directory. Fix the spelling of "KERBEROS". Start filling in variables so that we can populate config.nsh. Change-Id: I9b3ed912dfbffecbf09f2893efa2c9d82e709521 Reviewed-on: https://code.wireshark.org/review/6513 Reviewed-by: Gerald Combs --- CMakeLists.txt | 128 +++++++++++++++++++++++++++++ cmake/modules/FindAIRPCAP.cmake | 19 +++++ cmake/modules/FindCARES.cmake | 19 ++++- cmake/modules/FindGCRYPT.cmake | 29 +++++-- cmake/modules/FindGEOIP.cmake | 17 ++++ cmake/modules/FindGLIB2.cmake | 37 ++++++--- cmake/modules/FindGNUTLS.cmake | 24 ++++++ cmake/modules/FindKERBEROS.cmake | 27 +++++- cmake/modules/FindLUA.cmake | 24 +++++- cmake/modules/FindSMI.cmake | 24 +++++- cmake/modules/FindWinSparkle.cmake | 19 ++++- cmake/modules/FindZLIB.cmake | 23 +++++- cmake/modules/UseABICheck.cmake | 3 +- 13 files changed, 363 insertions(+), 30 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1a7ec440e0..3f15cee152 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1112,6 +1112,134 @@ set(LIBEPAN_LIBS ${WINSPARKLE_LIBRARIES} ) +if(WIN32) + # According to http://stackoverflow.com/questions/14474659/cmake-how-to-have-a-target-for-copying-files + # we can't just use "set(_dll_output_dir "$")" + get_target_property(_libwireshark_location epan LOCATION) + get_filename_component(_dll_output_dir "${_libwireshark_location}" PATH) + add_custom_target(copy_cli_dlls) + add_custom_command(TARGET copy_cli_dlls PRE_BUILD + COMMAND ${CMAKE_COMMAND} -E make_directory "${_dll_output_dir}" + ) + + # XXX Can (and should) we iterate over these similar to the way + # the top-level CMakeLists.txt iterates over the package list? + + # Required + foreach( _dll ${GLIB2_DLLS} ) + add_custom_command(TARGET copy_cli_dlls PRE_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_if_different + "${GLIB2_DLL_DIR}/${_dll}" + "${_dll_output_dir}" + ) + endforeach(_dll) + + # Optional + if (AIRPCAP_FOUND) + add_custom_command(TARGET copy_cli_dlls PRE_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_if_different + "${AIRPCAP_DLL_DIR}/${AIRPCAP_DLL}" + "${_dll_output_dir}" + ) + endif(AIRPCAP_FOUND) + if (CARES_FOUND) + add_custom_command(TARGET copy_cli_dlls PRE_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_if_different + "${CARES_DLL_DIR}/${CARES_DLL}" + "${_dll_output_dir}" + ) + endif(CARES_FOUND) + if (GEOIP_FOUND) + add_custom_command(TARGET copy_cli_dlls PRE_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_if_different + "${GEOIP_DLL_DIR}/${GEOIP_DLL}" + "${_dll_output_dir}" + ) + endif(GEOIP_FOUND) + if(GCRYPT_FOUND) + foreach( _dll ${GCRYPT_DLLS} ) + add_custom_command(TARGET copy_cli_dlls PRE_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_if_different + "${GCRYPT_DLL_DIR}/${_dll}" + "${_dll_output_dir}" + ) + endforeach(_dll) + endif(GCRYPT_FOUND) + if(GNUTLS_FOUND) + foreach( _dll ${GNUTLS_DLLS} ) + add_custom_command(TARGET copy_cli_dlls PRE_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_if_different + "${GNUTLS_DLL_DIR}/${_dll}" + "${_dll_output_dir}" + ) + endforeach(_dll) + endif(GNUTLS_FOUND) + if(KERBEROS_FOUND) + foreach( _dll ${KERBEROS_DLLS} ) + add_custom_command(TARGET copy_cli_dlls PRE_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_if_different + "${KERBEROS_DLL_DIR}/${_dll}" + "${_dll_output_dir}" + ) + endforeach(_dll) + endif(KERBEROS_FOUND) + if (LUA_FOUND) + add_custom_command(TARGET copy_cli_dlls PRE_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_if_different + "${LUA_DLL_DIR}/${LUA_DLL}" + "${_dll_output_dir}" + ) + endif(LUA_FOUND) + if (SMI_FOUND) + add_custom_command(TARGET copy_cli_dlls PRE_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_if_different + "${SMI_DLL_DIR}/${SMI_DLL}" + "${_dll_output_dir}" + COMMAND ${CMAKE_COMMAND} -E make_directory + "${_dll_output_dir}/snmp" + COMMAND ${CMAKE_COMMAND} -E make_directory + "${_dll_output_dir}/snmp/mibs" + COMMAND ${CMAKE_COMMAND} -E copy_directory + "${SMI_SHARE_DIR}/${SMI_DLL}/mibs/iana" + "${_dll_output_dir}/snmp/mibs" + COMMAND ${CMAKE_COMMAND} -E copy_directory + "${SMI_SHARE_DIR}/${SMI_DLL}/mibs/ietf" + "${_dll_output_dir}/snmp/mibs" + COMMAND ${CMAKE_COMMAND} -E copy_directory + "${SMI_SHARE_DIR}/${SMI_DLL}/mibs/irtf" + "${_dll_output_dir}/snmp/mibs" + COMMAND ${CMAKE_COMMAND} -E copy_directory + "${SMI_SHARE_DIR}/${SMI_DLL}/mibs/site" + "${_dll_output_dir}/snmp/mibs" + COMMAND ${CMAKE_COMMAND} -E copy_directory + "${SMI_SHARE_DIR}/${SMI_DLL}/mibs/tubs" + "${_dll_output_dir}/snmp/mibs" + COMMAND ${CMAKE_COMMAND} -E copy_directory + "${SMI_SHARE_DIR}/${SMI_DLL}/pibs" + "${_dll_output_dir}/snmp/mibs" + COMMAND ${CMAKE_COMMAND} -E copy_directory + "${SMI_SHARE_DIR}/${SMI_DLL}/yang" + "${_dll_output_dir}/snmp/mibs" + ) + endif(SMI_FOUND) + if (WINSPARKLE_FOUND) + add_custom_command(TARGET copy_cli_dlls PRE_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_if_different + "${WINSPARKLE_DLL_DIR}/${WINSPARKLE_DLL}" + "${_dll_output_dir}" + ) + endif(WINSPARKLE_FOUND) + if (ZLIB_FOUND) + add_custom_command(TARGET copy_cli_dlls PRE_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_if_different + "${ZLIB_DLL_DIR}/${ZLIB_DLL}" + "${_dll_output_dir}" + ) + endif(ZLIB_FOUND) + + add_dependencies(epan copy_cli_dlls) +endif() + if( (BUILD_wireshark AND QT_FOUND) OR (BUILD_wireshark_gtk AND GTK_FOUND) ) set(WIRESHARK_SRC capture_info.c diff --git a/cmake/modules/FindAIRPCAP.cmake b/cmake/modules/FindAIRPCAP.cmake index afc93f97c0..756dce4bff 100644 --- a/cmake/modules/FindAIRPCAP.cmake +++ b/cmake/modules/FindAIRPCAP.cmake @@ -5,6 +5,8 @@ # AIRPCAP_INCLUDE_DIRS - where to find pcap.h, etc. # AIRPCAP_LIBRARIES - List of libraries when using pcap. # AIRPCAP_FOUND - True if pcap found. +# AIRPCAP_DLL_DIR - (Windows) Path to the AirPcap DLL. +# AIRPCAP_DLL - (Windows) Name of the AirPcap DLL. include( FindWSWinLibs ) FindWSWinLibs( "AirPcap" AIRPCAP_TMP_HINTS ) @@ -34,9 +36,26 @@ find_package_handle_standard_args( AIRPCAP DEFAULT_MSG AIRPCAP_INCLUDE_DIR AIRPC if( AIRPCAP_FOUND ) set( AIRPCAP_INCLUDE_DIRS ${AIRPCAP_INCLUDE_DIR} ) set( AIRPCAP_LIBRARIES ${AIRPCAP_LIBRARY} ) + if(WIN32) + set ( _platform_subdir "x86" ) + if( WIN32 AND "${WIRESHARK_TARGET_PLATFORM}" STREQUAL "win64" ) + set ( _platform_subdir "x64" ) + endif() + + set ( AIRPCAP_DLL_DIR "${AIRPCAP_HINTS}/bin/${_platform_subdir}" + CACHE PATH "Path to AirPcap DLL" + ) + set ( AIRPCAP_DLL airpcap.dll + # We're storing filenames only. Should we use STRING instead? + CACHE FILEPATH "AirPcap DLL file name" + ) + mark_as_advanced( AIRPCAP_DLL_DIR AIRPCAP_DLL ) + endif() else() set( AIRPCAP_INCLUDE_DIRS ) set( AIRPCAP_LIBRARIES ) + set( AIRPCAP_DLL_DIR ) + set( AIRPCAP_DLLS ) endif() mark_as_advanced( AIRPCAP_LIBRARIES AIRPCAP_INCLUDE_DIRS ) diff --git a/cmake/modules/FindCARES.cmake b/cmake/modules/FindCARES.cmake index 1d90838f2a..11719a601a 100644 --- a/cmake/modules/FindCARES.cmake +++ b/cmake/modules/FindCARES.cmake @@ -5,6 +5,8 @@ # CARES_INCLUDE_DIRS - where to find cares.h, etc. # CARES_LIBRARIES - List of libraries when using cares. # CARES_FOUND - True if cares found. +# CARES_DLL_DIR - (Windows) Path to the c-ares DLL. +# CARES_DLL - (Windows) Name of the c-ares DLL. IF (CARES_INCLUDE_DIRS) @@ -20,7 +22,7 @@ FIND_PATH(CARES_INCLUDE_DIR ares.h HINTS "${CARES_HINTS}/include" ) SET(CARES_NAMES cares libcares-2) FIND_LIBRARY(CARES_LIBRARY NAMES ${CARES_NAMES} HINTS "${CARES_HINTS}/lib" ) -# handle the QUIETLY and REQUIRED arguments and set CARES_FOUND to TRUE if +# handle the QUIETLY and REQUIRED arguments and set CARES_FOUND to TRUE if # all listed variables are TRUE INCLUDE(FindPackageHandleStandardArgs) FIND_PACKAGE_HANDLE_STANDARD_ARGS(CARES DEFAULT_MSG CARES_LIBRARY CARES_INCLUDE_DIR) @@ -28,9 +30,24 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(CARES DEFAULT_MSG CARES_LIBRARY CARES_INCLUDE_ IF(CARES_FOUND) SET( CARES_LIBRARIES ${CARES_LIBRARY} ) SET( CARES_INCLUDE_DIRS ${CARES_INCLUDE_DIR} ) + if (WIN32) + set ( CARES_DLL_DIR "${CARES_HINTS}/bin" + CACHE PATH "Path to C-Ares DLL" + ) + file( GLOB _cares_dll RELATIVE "${CARES_DLL_DIR}" + "${CARES_DLL_DIR}/libcares-*.dll" + ) + set ( CARES_DLL ${_cares_dll} + # We're storing filenames only. Should we use STRING instead? + CACHE FILEPATH "C-Ares DLL file name" + ) + mark_as_advanced( CARES_DLL_DIR CARES_DLL ) + endif() ELSE(CARES_FOUND) SET( CARES_LIBRARIES ) SET( CARES_INCLUDE_DIRS ) + SET( CARES_DLL_DIR ) + SET( CARES_DLL ) ENDIF(CARES_FOUND) MARK_AS_ADVANCED( CARES_LIBRARIES CARES_INCLUDE_DIRS ) diff --git a/cmake/modules/FindGCRYPT.cmake b/cmake/modules/FindGCRYPT.cmake index 1ff89724ab..0b4271a8ed 100644 --- a/cmake/modules/FindGCRYPT.cmake +++ b/cmake/modules/FindGCRYPT.cmake @@ -5,6 +5,8 @@ # GCRYPT_INCLUDE_DIRS - where to find gcrypt.h, etc. # GCRYPT_LIBRARIES - List of libraries when using gcrypt. # GCRYPT_FOUND - True if gcrypt found. +# GCRYPT_DLL_DIR - (Windows) Path to the Libgcrypt DLLs. +# GCRYPT_DLLS - (Windows) List of required Libgcrypt DLLs. IF (GCRYPT_INCLUDE_DIRS) @@ -16,17 +18,17 @@ INCLUDE(FindWSWinLibs) FindWSWinLibs("gnutls-.*" "GCRYPT_HINTS") FIND_PATH(GCRYPT_INCLUDE_DIR gcrypt.h - HINTS - "${GCRYPT_HINTS}" - PATH_SUFFIXES - include + HINTS + "${GCRYPT_HINTS}" + PATH_SUFFIXES + include ) SET(GCRYPT_NAMES gcrypt libgcrypt-20) FIND_LIBRARY(GCRYPT_LIBRARY NAMES ${GCRYPT_NAMES} libgcc_s_sjlj-1 HINTS "${GCRYPT_HINTS}/bin") FIND_LIBRARY(GCRYPT_ERROR_LIBRARY NAMES gpg-error libgpg-error-0 libgpg-error6-0 HINTS "${GCRYPT_HINTS}/bin") -# handle the QUIETLY and REQUIRED arguments and set GCRYPT_FOUND to TRUE if +# handle the QUIETLY and REQUIRED arguments and set GCRYPT_FOUND to TRUE if # all listed variables are TRUE INCLUDE(FindPackageHandleStandardArgs) FIND_PACKAGE_HANDLE_STANDARD_ARGS(GCRYPT DEFAULT_MSG GCRYPT_LIBRARY GCRYPT_INCLUDE_DIR) @@ -34,9 +36,26 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(GCRYPT DEFAULT_MSG GCRYPT_LIBRARY GCRYPT_INCLU IF(GCRYPT_FOUND) SET( GCRYPT_LIBRARIES ${GCRYPT_LIBRARY} ${GCRYPT_ERROR_LIBRARY}) SET( GCRYPT_INCLUDE_DIRS ${GCRYPT_INCLUDE_DIR}) + if (WIN32) + set ( GCRYPT_DLL_DIR "${GCRYPT_HINTS}/bin" + CACHE PATH "Path to the Libgcrypt DLLs" + ) + file( GLOB _gcrypt_dlls RELATIVE "${GCRYPT_DLL_DIR}" + "${GCRYPT_DLL_DIR}/libgcc_s_*.dll" + "${GCRYPT_DLL_DIR}/libgcrypt-*.dll" + "${GCRYPT_DLL_DIR}/libgpg-error*.dll" + ) + set ( GCRYPT_DLLS ${_gcrypt_dlls} + # We're storing filenames only. Should we use STRING instead? + CACHE FILEPATH "Libgcrypt DLL list" + ) + mark_as_advanced( GCRYPT_DLL_DIR GCRYPT_DLLS ) + endif() ELSE(GCRYPT_FOUND) SET( GCRYPT_LIBRARIES ) SET( GCRYPT_INCLUDE_DIRS ) + SET( GCRYPT_DLL_DIR ) + SET( GCRYPT_DLLS ) ENDIF(GCRYPT_FOUND) MARK_AS_ADVANCED( GCRYPT_LIBRARIES GCRYPT_INCLUDE_DIRS ) diff --git a/cmake/modules/FindGEOIP.cmake b/cmake/modules/FindGEOIP.cmake index add3187eca..ce968b70ef 100644 --- a/cmake/modules/FindGEOIP.cmake +++ b/cmake/modules/FindGEOIP.cmake @@ -5,6 +5,8 @@ # GEOIP_INCLUDE_DIRS - where to find GeoIP.h, etc. # GEOIP_LIBRARIES - List of libraries when using GeoIP. # GEOIP_FOUND - True if GeoIP found. +# GEOIP_DLL_DIR - (Windows) Path to the GeoIP DLL. +# GEOIP_DLL - (Windows) Name of the GeoIP DLL. IF (GEOIP_INCLUDE_DIRS) @@ -45,9 +47,24 @@ IF(GEOIP_FOUND) CHECK_FUNCTION_EXISTS("GeoIP_country_name_by_ipnum_v6" HAVE_GEOIP_V6) SET(CMAKE_REQUIRED_INCLUDES "") SET(CMAKE_REQUIRED_LIBRARIES "") + if (WIN32) + set ( GEOIP_DLL_DIR "${GEOIP_HINTS}/bin" + CACHE PATH "Path to the GeoIP DLL" + ) + file( GLOB _geoip_dll RELATIVE "${GEOIP_DLL_DIR}" + "${GEOIP_DLL_DIR}/libGeoIP-*.dll" + ) + set ( GEOIP_DLL ${_geoip_dll} + # We're storing filenames only. Should we use STRING instead? + CACHE FILEPATH "GeoIP DLL file name" + ) + mark_as_advanced( GEOIP_DLL_DIR GEOIP_DLL ) + endif() ELSE(GEOIP_FOUND) SET(GEOIP_LIBRARIES ) SET(GEOIP_INCLUDE_DIRS ) + SET(GEOIP_DLL_DIR ) + SET(GEOIP_DLL ) ENDIF(GEOIP_FOUND) MARK_AS_ADVANCED( GEOIP_LIBRARIES GEOIP_INCLUDE_DIRS ) diff --git a/cmake/modules/FindGLIB2.cmake b/cmake/modules/FindGLIB2.cmake index a376fb42e4..ab13acf572 100644 --- a/cmake/modules/FindGLIB2.cmake +++ b/cmake/modules/FindGLIB2.cmake @@ -2,9 +2,11 @@ # - Try to find the GLIB2 libraries # Once done this will define # -# GLIB2_FOUND - system has glib2 +# GLIB2_FOUND - system has glib2 # GLIB2_INCLUDE_DIRS - the glib2 include directory -# GLIB2_LIBRARIES - glib2 library +# GLIB2_LIBRARIES - glib2 library +# GLIB2_DLL_DIR - (Windows) Path to required GLib2 DLLs. +# GLIB2_DLLS - (Windows) List of required GLib2 DLLs. # Copyright (c) 2008 Laurent Montel, # @@ -18,14 +20,11 @@ if( GLIB2_MAIN_INCLUDE_DIR AND GLIB2_LIBRARIES ) endif() include( FindWSWinLibs ) -if( BUILD_wireshark ) - if( ENABLE_GTK3 ) - FindWSWinLibs( "gtk3" "GLIB2_HINTS" ) - else() - FindWSWinLibs( "gtk2" "GLIB2_HINTS" ) - endif() + +if( ENABLE_GTK3 ) + FindWSWinLibs( "gtk3" "GLIB2_HINTS" ) else() - message( ERROR "Unsupported build setup" ) + FindWSWinLibs( "gtk2" "GLIB2_HINTS" ) endif() find_package( PkgConfig ) @@ -97,12 +96,30 @@ find_package_handle_standard_args( GLIB2 if( GLIB2_FOUND ) set( GLIB2_LIBRARIES ${GLIB2_LIBRARY} ) set( GLIB2_INCLUDE_DIRS ${GLIB2_MAIN_INCLUDE_DIR} ${GLIB2_INTERNAL_INCLUDE_DIR} ) + if ( WIN32 AND GLIB2_FOUND ) + set ( GLIB2_DLL_DIR "${GLIB2_HINTS}/bin" + CACHE PATH "Path to GLib 2 DLLs" + ) + file( GLOB _glib2_dlls RELATIVE "${GLIB2_DLL_DIR}" + "${GLIB2_DLL_DIR}/libglib-*.dll" + "${GLIB2_DLL_DIR}/libgio-*.dll" + "${GLIB2_DLL_DIR}/libgmodule-*.dll" + "${GLIB2_DLL_DIR}/libgobject-*.dll" + "${GLIB2_DLL_DIR}/libintl-*.dll" + ) + set ( GLIB2_DLLS ${_glib2_dlls} + # We're storing filenames only. Should we use STRING instead? + CACHE FILEPATH "GLib 2 DLL list" + ) + mark_as_advanced( GLIB2_DLL_DIR GLIB2_DLLS ) + endif() elseif( GLIB2_FIND_REQUIRED ) message( SEND_ERROR "Package required but not found" ) else() set( GLIB2_LIBRARIES ) set( GLIB2_MAIN_INCLUDE_DIRS ) + set( GLIB2_DLL_DIR ) + set( GLIB2_DLLS ) endif() mark_as_advanced( GLIB2_INCLUDE_DIRS GLIB2_LIBRARIES ) - diff --git a/cmake/modules/FindGNUTLS.cmake b/cmake/modules/FindGNUTLS.cmake index 492fd8f41a..2803aa8350 100644 --- a/cmake/modules/FindGNUTLS.cmake +++ b/cmake/modules/FindGNUTLS.cmake @@ -5,6 +5,8 @@ # GNUTLS_INCLUDE_DIRS - where to find gnutls.h, etc. # GNUTLS_LIBRARIES - List of libraries when using gnutls. # GNUTLS_FOUND - True if gnutls found. +# GNUTLS_DLL_DIR - (Windows) Path to the GnuTLS DLLs. +# GNUTLS_DLLS - (Windows) List of required GnuTLS DLLs. IF (GNUTLS_INCLUDE_DIRS) @@ -48,9 +50,31 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(GNUTLS DEFAULT_MSG GNUTLS_LIBRARY GNUTLS_INCLU IF(GNUTLS_FOUND) SET( GNUTLS_LIBRARIES ${GNUTLS_LIBRARY} ) SET( GNUTLS_INCLUDE_DIRS ${GNUTLS_INCLUDE_DIR} ) + if (WIN32) + set ( GNUTLS_DLL_DIR "${GNUTLS_HINTS}/bin" + CACHE PATH "Path to the GnuTLS DLLs" + ) + file( GLOB _gnutls_dlls RELATIVE "${GNUTLS_DLL_DIR}" + "${GNUTLS_DLL_DIR}/libgmp-*.dll" + "${GNUTLS_DLL_DIR}/libgcc_s_*.dll" + "${GNUTLS_DLL_DIR}/libffi-*.dll" + "${GNUTLS_DLL_DIR}/libgnutls-*.dll" + "${GNUTLS_DLL_DIR}/libhogweed-*.dll" + "${GNUTLS_DLL_DIR}/libnettle-*.dll" + "${GNUTLS_DLL_DIR}/libp11-kit-*.dll" + "${GNUTLS_DLL_DIR}/libtasn1-*.dll" + ) + set ( GNUTLS_DLLS ${_gnutls_dlls} + # We're storing filenames only. Should we use STRING instead? + CACHE FILEPATH "GnuTLS DLL list" + ) + mark_as_advanced( GNUTLS_DLL_DIR GNUTLS_DLLS ) + endif() ELSE(GNUTLS_FOUND) SET( GNUTLS_LIBRARIES ) SET( GNUTLS_INCLUDE_DIRS ) + SET( GNUTLS_DLL_DIR ) + SET( GNUTLS_DLLS ) ENDIF(GNUTLS_FOUND) MARK_AS_ADVANCED( GNUTLS_LIBRARIES GNUTLS_INCLUDE_DIRS ) diff --git a/cmake/modules/FindKERBEROS.cmake b/cmake/modules/FindKERBEROS.cmake index aec66afdb3..c8a2b6841f 100644 --- a/cmake/modules/FindKERBEROS.cmake +++ b/cmake/modules/FindKERBEROS.cmake @@ -5,6 +5,8 @@ # KERBEROS_INCLUDE_DIRS - where to find krb5.h, etc. # KERBEROS_LIBRARIES - List of libraries when using krb5. # KERBEROS_FOUND - True if krb5 found. +# KERBEROS_DLL_DIR - (Windows) Path to the Kerberos DLLs. +# KERBEROS_DLLS - (Windows) List of required Kerberos DLLs. IF (KERBEROS_INCLUDE_DIRS) @@ -13,7 +15,7 @@ IF (KERBEROS_INCLUDE_DIRS) ENDIF (KERBEROS_INCLUDE_DIRS) INCLUDE(FindWSWinLibs) -FindWSWinLibs("kfw-.*" "KERBOROS_HINTS") +FindWSWinLibs("kfw-.*" "KERBEROS_HINTS") find_package(PkgConfig) pkg_search_module(KERBEROS krb5) @@ -21,17 +23,17 @@ pkg_search_module(KERBEROS krb5) FIND_PATH(KERBEROS_INCLUDE_DIR krb5.h HINTS "${KERBEROS_INCLUDEDIR}" - "${KERBOROS_HINTS}/include" + "${KERBEROS_HINTS}/include" ) SET(KERBEROS_NAMES krb5 krb5_32 krb5_64) FIND_LIBRARY(KERBEROS_LIBRARY NAMES ${KERBEROS_NAMES} HINTS "${KERBEROS_LIBDIR}" - "${KERBOROS_HINTS}/lib" + "${KERBEROS_HINTS}/lib" ) -# handle the QUIETLY and REQUIRED arguments and set KERBEROS_FOUND to TRUE if +# handle the QUIETLY and REQUIRED arguments and set KERBEROS_FOUND to TRUE if # all listed variables are TRUE INCLUDE(FindPackageHandleStandardArgs) FIND_PACKAGE_HANDLE_STANDARD_ARGS(KERBEROS DEFAULT_MSG KERBEROS_LIBRARY KERBEROS_INCLUDE_DIR) @@ -45,9 +47,26 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(KERBEROS DEFAULT_MSG KERBEROS_LIBRARY KERBEROS IF(KERBEROS_FOUND) SET( KERBEROS_LIBRARIES ${KERBEROS_LIBRARY} ) SET( KERBEROS_INCLUDE_DIRS ${KERBEROS_INCLUDE_DIR} ) + if (WIN32) + set ( KERBEROS_DLL_DIR "${KERBEROS_HINTS}/bin" + CACHE PATH "Path to the Kerberos DLLs" + ) + file( GLOB _kerberos_dlls RELATIVE "${KERBEROS_DLL_DIR}" + "${KERBEROS_DLL_DIR}/comerr??.dll" + "${KERBEROS_DLL_DIR}/krb5_??.dll" + "${KERBEROS_DLL_DIR}/k5sprt??.dll" + ) + set ( KERBEROS_DLLS ${_kerberos_dlls} + # We're storing filenames only. Should we use STRING instead? + CACHE FILEPATH "Kerberos DLL list" + ) + mark_as_advanced( KERBEROS_DLL_DIR KERBEROS_DLLS ) + endif() ELSE(KERBEROS_FOUND) SET( KERBEROS_LIBRARIES ) SET( KERBEROS_INCLUDE_DIRS ) + SET( KERBEROS_DLL_DIR ) + SET( KERBEROS_DLLS ) ENDIF(KERBEROS_FOUND) MARK_AS_ADVANCED( KERBEROS_LIBRARIES KERBEROS_INCLUDE_DIRS ) diff --git a/cmake/modules/FindLUA.cmake b/cmake/modules/FindLUA.cmake index f51eb7cba3..472572adaf 100644 --- a/cmake/modules/FindLUA.cmake +++ b/cmake/modules/FindLUA.cmake @@ -1,9 +1,11 @@ # # Locate Lua library # This module defines -# LUA_FOUND, if false, do not try to link to Lua +# LUA_FOUND - If false, do not try to link to Lua # LUA_LIBRARIES -# LUA_INCLUDE_DIRS, where to find lua.h +# LUA_INCLUDE_DIRS - Where to find lua.h +# LUA_DLL_DIR - (Windows) Path to the Lua DLL. +# LUA_DLL - (Windows) Name of the Lua DLL. # # Note that the expected include convention is # #include "lua.h" @@ -69,7 +71,7 @@ FIND_LIBRARY(LUA_LIBRARY ) INCLUDE(FindPackageHandleStandardArgs) -# handle the QUIETLY and REQUIRED arguments and set LUA_FOUND to TRUE if +# handle the QUIETLY and REQUIRED arguments and set LUA_FOUND to TRUE if # all listed variables are TRUE FIND_PACKAGE_HANDLE_STANDARD_ARGS(LUA DEFAULT_MSG LUA_LIBRARY LUA_INCLUDE_DIR) message("LUA INCLUDEs version: ${LUA_VERSION}") @@ -77,10 +79,24 @@ message("LUA INCLUDEs version: ${LUA_VERSION}") IF(LUA_LIBRARY) SET( LUA_LIBRARIES "${LUA_LIBRARY}") SET( LUA_INCLUDE_DIRS ${LUA_INCLUDE_DIR} ) + if (WIN32) + set ( LUA_DLL_DIR "${LUA_HINTS}" + CACHE PATH "Path to Lua DLL" + ) + file( GLOB _lua_dll RELATIVE "${LUA_DLL_DIR}" + "${LUA_DLL_DIR}/lua*.dll" + ) + set ( LUA_DLL ${_lua_dll} + # We're storing filenames only. Should we use STRING instead? + CACHE FILEPATH "Lua DLL file name" + ) + mark_as_advanced( LUA_DLL_DIR LUA_DLL ) + endif() ELSE(LUA_LIBRARY) SET( LUA_LIBRARIES ) SET( LUA_INCLUDE_DIRS ) + SET( LUA_DLL_DIR ) + SET( LUA_DLL ) ENDIF(LUA_LIBRARY) MARK_AS_ADVANCED(LUA_INCLUDE_DIRS LUA_LIBRARIES) - diff --git a/cmake/modules/FindSMI.cmake b/cmake/modules/FindSMI.cmake index 8a6c27eade..e8ce5020bf 100644 --- a/cmake/modules/FindSMI.cmake +++ b/cmake/modules/FindSMI.cmake @@ -5,6 +5,9 @@ # SMI_INCLUDE_DIRS - where to find smi.h, etc. # SMI_LIBRARIES - List of libraries when using smi. # SMI_FOUND - True if smi found. +# SMI_DLL_DIR - (Windows) Path to the SMI DLL. +# SMI_DLL - (Windows) Name of the SMI DLL. +# SMI_SHARE_DIR - (Windows) Path to the SMI MIBs. IF (SMI_INCLUDE_DIR) @@ -20,7 +23,7 @@ FIND_PATH(SMI_INCLUDE_DIR smi.h HINTS "${SMI_HINTS}/include" ) SET(SMI_NAMES smi libsmi-2) FIND_LIBRARY(SMI_LIBRARY NAMES ${SMI_NAMES} HINTS "${SMI_HINTS}/lib" ) -# handle the QUIETLY and REQUIRED arguments and set SMI_FOUND to TRUE if +# handle the QUIETLY and REQUIRED arguments and set SMI_FOUND to TRUE if # all listed variables are TRUE INCLUDE(FindPackageHandleStandardArgs) FIND_PACKAGE_HANDLE_STANDARD_ARGS(SMI DEFAULT_MSG SMI_LIBRARY SMI_INCLUDE_DIR) @@ -28,9 +31,28 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(SMI DEFAULT_MSG SMI_LIBRARY SMI_INCLUDE_DIR) IF(SMI_FOUND) SET( SMI_LIBRARIES ${SMI_LIBRARY} ) SET( SMI_INCLUDE_DIRS ${SMI_INCLUDE_DIR} ) + if (WIN32) + set ( SMI_DLL_DIR "${SMI_HINTS}/bin" + CACHE PATH "Path to the SMI DLL" + ) + set ( SMI_SHARE_DIR "${SMI_HINTS}/share" + CACHE PATH "Path to the SMI MIBs" + ) + file( GLOB _smi_dll RELATIVE "${SMI_DLL_DIR}" + "${SMI_DLL_DIR}/libsmi-*.dll" + ) + set ( SMI_DLL ${_smi_dll} + # We're storing filenames only. Should we use STRING instead? + CACHE FILEPATH "SMI DLL file name" + ) + mark_as_advanced( SMI_DLL_DIR SMI_DLL ) + endif() ELSE(SMI_FOUND) SET( SMI_LIBRARIES ) SET( SMI_INCLUDE_DIRS ) + SET( SMI_DLL_DIR ) + SET( SMI_SHARE_DIR ) + SET( SMI_DLL ) ENDIF(SMI_FOUND) MARK_AS_ADVANCED( SMI_LIBRARIES SMI_INCLUDE_DIRS ) diff --git a/cmake/modules/FindWinSparkle.cmake b/cmake/modules/FindWinSparkle.cmake index 8680b1a648..54c01d8903 100644 --- a/cmake/modules/FindWinSparkle.cmake +++ b/cmake/modules/FindWinSparkle.cmake @@ -5,6 +5,8 @@ # WINSPARKLE_INCLUDE_DIRS - where to find WinSparkle.h, etc. # WINSPARKLE_LIBRARIES - List of libraries when using WinSparkle. # WINSPARKLE_FOUND - True if WinSparkle found. +# WINSPARKLE_DLL_DIR - (Windows) Path to the WinSparkle DLL. +# WINSPARKLE_DLL - (Windows) Name of the WinSparkle DLL. IF (WINSPARKLE_INCLUDE_DIRS) @@ -13,7 +15,7 @@ IF (WINSPARKLE_INCLUDE_DIRS) ENDIF (WINSPARKLE_INCLUDE_DIRS) INCLUDE(FindWSWinLibs) -FindWSWinLibs("WinSparkle-.*" "WINSPARKLE_HINTS") +FindWSWinLibs("WinSparkle.*" "WINSPARKLE_HINTS") FIND_PATH(WINSPARKLE_INCLUDE_DIR winsparkle.h HINTS "${WINSPARKLE_HINTS}" ) @@ -27,9 +29,24 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(WINSPARKLE DEFAULT_MSG WINSPARKLE_LIBRARY WINS IF(WINSPARKLE_FOUND) SET(WINSPARKLE_LIBRARIES ${WINSPARKLE_LIBRARY} ) SET(WINSPARKLE_INCLUDE_DIRS ${WINSPARKLE_INCLUDE_DIR} ) + if (WIN32) + set ( WINSPARKLE_DLL_DIR "${WINSPARKLE_HINTS}" + CACHE PATH "Path to the WinSparkle DLL" + ) + file( GLOB _winsparkle_dll RELATIVE "${WINSPARKLE_DLL_DIR}" + "${WINSPARKLE_DLL_DIR}/WinSparkle.dll" + ) + set ( WINSPARKLE_DLL ${_winsparkle_dll} + # We're storing filenames only. Should we use STRING instead? + CACHE FILEPATH "WinSparkle DLL file name" + ) + mark_as_advanced( WINSPARKLE_DLL_DIR WINSPARKLE_DLL ) + endif() ELSE(WINSPARKLE_FOUND) SET(WINSPARKLE_LIBRARIES ) SET(WINSPARKLE_INCLUDE_DIRS ) + SET(WINSPARKLE_DLL_DIR ) + SET(WINSPARKLE_DLL ) ENDIF(WINSPARKLE_FOUND) MARK_AS_ADVANCED( WINSPARKLE_LIBRARIES WINSPARKLE_INCLUDE_DIRS ) diff --git a/cmake/modules/FindZLIB.cmake b/cmake/modules/FindZLIB.cmake index 956046f075..9fcbb39032 100644 --- a/cmake/modules/FindZLIB.cmake +++ b/cmake/modules/FindZLIB.cmake @@ -6,6 +6,8 @@ # ZLIB_INCLUDE_DIRS - where to find zlib.h, etc. # ZLIB_LIBRARIES - List of libraries when using zlib. # ZLIB_FOUND - True if zlib found. +# ZLIB_DLL_DIR - (Windows) Path to the zlib DLL. +# ZLIB_DLL - (Windows) Name of the zlib DLL. # # ZLIB_VERSION_STRING - The version of zlib found (x.y.z) # ZLIB_VERSION_MAJOR - The major version of zlib @@ -88,7 +90,7 @@ CHECK_FUNCTION_EXISTS("inflatePrime" HAVE_INFLATEPRIME) # reset SET(CMAKE_REQUIRED_LIBRARIES "") -# handle the QUIETLY and REQUIRED arguments and set ZLIB_FOUND to TRUE if +# handle the QUIETLY and REQUIRED arguments and set ZLIB_FOUND to TRUE if # all listed variables are TRUE INCLUDE(FindPackageHandleStandardArgs) FIND_PACKAGE_HANDLE_STANDARD_ARGS(ZLIB REQUIRED_VARS ZLIB_LIBRARY ZLIB_INCLUDE_DIR @@ -97,5 +99,22 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(ZLIB REQUIRED_VARS ZLIB_LIBRARY ZLIB_INCLUDE_D IF(ZLIB_FOUND) SET(ZLIB_INCLUDE_DIRS ${ZLIB_INCLUDE_DIR}) SET(ZLIB_LIBRARIES ${ZLIB_LIBRARY}) + if (WIN32) + set ( ZLIB_DLL_DIR "${ZLIB_HINTS}" + CACHE PATH "Path to the Zlib DLL" + ) + file( GLOB _zlib_dll RELATIVE "${ZLIB_DLL_DIR}" + "${ZLIB_DLL_DIR}/zlib1.dll" + ) + set ( ZLIB_DLL ${_zlib_dll} + # We're storing filenames only. Should we use STRING instead? + CACHE FILEPATH "Zlib DLL file name" + ) + mark_as_advanced( ZLIB_DLL_DIR ZLIB_DLL ) + endif() +ELSE() + SET(ZLIB_INCLUDE_DIRS ) + SET(ZLIB_LIBRARIES ) + SET(ZLIB_DLL_DIR ) + SET(ZLIB_DLL ) ENDIF() - diff --git a/cmake/modules/UseABICheck.cmake b/cmake/modules/UseABICheck.cmake index 0b391b6825..9ed39da0ee 100644 --- a/cmake/modules/UseABICheck.cmake +++ b/cmake/modules/UseABICheck.cmake @@ -18,8 +18,7 @@ MACRO(ABICHECK _libname) # checks file(GLOB HEADERS *.h) file(MAKE_DIRECTORY ${ABICHECK_TMPDIR}) - file(COPY ${HEADERS} ../ws_symbol_export.h DESTINATION ${ABICHECK_TMPDIR}) + file(COPY ${HEADERS} ${CMAKE_SOURCE_DIR}/ws_symbol_export.h DESTINATION ${ABICHECK_TMPDIR}) add_custom_target(dumpabi-${_libname} DEPENDS ${_libname}.abi.tar.gz) set_target_properties(dumpabi-${_libname} PROPERTIES FOLDER "Auxilary") ENDMACRO() -