Beginnings of win cmake support (not yet working), created by Graham Bloice,
authorJörg Mayer <jmayer@loplof.de>
Mon, 23 Sep 2013 21:45:55 +0000 (21:45 -0000)
committerJörg Mayer <jmayer@loplof.de>
Mon, 23 Sep 2013 21:45:55 +0000 (21:45 -0000)
some smaller changes by me.
- README.cmake
  Document how to (one day) run on Windows
- CMakeLists.txt
  Use MSVC compiler flags for MSVC instead of gcc flags
- FindWSWinLibs.cmake
  New: Creates HINTS for finding includes and libraries
  inside the Wireshark support library installation.
- FindXXX.cmake
  Make use of HINTS generated by FindWSWinLibs.cmake

This has not really been tested on Windows as my installation seems to have
automagically downloaded some fixes and is in an inconsistent state since.
Will probably need to reinstall.

svn path=/trunk/; revision=52194

16 files changed:
CMakeLists.txt
README.cmake
cmake/modules/FindCARES.cmake
cmake/modules/FindGCRYPT.cmake
cmake/modules/FindGEOIP.cmake
cmake/modules/FindGLIB2.cmake
cmake/modules/FindGMODULE2.cmake
cmake/modules/FindGNUTLS.cmake
cmake/modules/FindGTHREAD2.cmake
cmake/modules/FindGTK2.cmake
cmake/modules/FindKERBEROS.cmake
cmake/modules/FindLUA.cmake
cmake/modules/FindPCAP.cmake
cmake/modules/FindPORTAUDIO.cmake
cmake/modules/FindSMI.cmake
cmake/modules/FindWSWinLibs.cmake [new file with mode: 0644]

index 9a1020340a51a285eef9d0ff9f8d9ef8773619e7..9fa87b5382953a98e60fe94d703ea864a1cb32db 100644 (file)
@@ -114,86 +114,113 @@ endif()
 
 include(CMakeOptions.txt)
 
-
-set(WIRESHARK_C_FLAGS
-       -O2
-       -g
-       -Wall
-       -W
-       -Wextra
-       -Wendif-labels
-       -Wpointer-arith
-       -Warray-bounds
-       -Wformat-security
-       -Wshorten-64-to-32
-       -Wvla
-       -Waddress
-       -Warray-bounds
-       -Wattributes
-       -Wdiv-by-zero
-       -Wignored-qualifiers
-       -Wno-overlength-strings
-       -Wwrite-strings
-       -Wno-long-long
-       -Wpragmas
-)
-
-set(WIRESHARK_C_ONLY_FLAGS
-       # The following are C only, not C++
-       -Wc++-compat
-       -Wdeclaration-after-statement
-       -Wshadow
-       -Wno-pointer-sign
-       -Wold-style-definition
-       -Wstrict-prototypes
-       -Wlogical-op
-       -Wjump-misses-init
-)
-
-set(WIRESHARK_EXTRA_C_FLAGS
-       -pedantic
-       -Woverflow
-       -fstrict-overflow -Wstrict-overflow=4
-       -Wunreachable-code
-       -Wunsafe-loop-optimizations
-       -Wcast-align
-       -Wcast-qual
-       -Wformat-security
-       -Wredundant-decls
-       # All the registration functions block these for now.
-       -Wmissing-declarations
-)
-
-set(WIRESHARK_EXTRA_C_ONLY_FLAGS
-       # The following are C only, not C++
-       -Wbad-function-cast
-       # All the registration functions block these for now.
-       -Wmissing-prototypes
-)
-
-# With clang some tests don't fail properly during testing but only
-# during real compiles
-
-if(NOT CMAKE_C_COMPILER_ID MATCHES "Clang")
-
-       set(WIRESHARK_C_FLAGS ${WIRESHARK_C_FLAGS}
-           -fexcess-precision=fast
-       )
-
-       set(WIRESHARK_C_ONLY_FLAGS ${WIRESHARK_C_ONLY_FLAGS}
-       )
-endif()
-
-if(ENABLE_EXTRA_GCC_CHECKS)   # This overrides -Werror
-       set(WIRESHARK_C_FLAGS ${WIRESHARK_C_FLAGS} ${WIRESHARK_EXTRA_C_FLAGS})
-       set(WIRESHARK_C_ONLY_FLAGS ${WIRESHARK_C_ONLY_FLAGS} ${WIRESHARK_EXTRA_C_ONLY_FLAGS})
+if( CMAKE_C_COMPILER_ID MATCHES "MSVC")
+    set(LOCAL_CFLAGS
+        /Zi
+        /W3
+        /MD
+        /DWIN32_LEAN_AND_MEAN
+        "/DMSC_VER_REQUIRED=${MSC_VER_REQUIRED}"
+        /D_CRT_SECURE_NO_DEPRECATE
+        /D_CRT_NONSTDC_NO_DEPRECATE
+        /MP
+    )
+
+    if(NOT WIN64)
+        set(LOCAL_CFLAGS ${LOCAL_CFLAGS} "/D_BIND_TO_CURRENT_CRT_VERSION=1")
+    endif()
+
+    # Additional compiler warnings to be treated as "Level 3"
+    #  when compiling Wireshark sources. (Selected from "level 4" warnings).
+    ## 4295: array is too small to include a terminating null character
+    set(WARNINGS_CFLAGS "/w34295")
+
+    set(WIRESHARK_C_FLAGS
+        "/DPCAP_VERSION=${PCAP_VERSION}"
+        ${LOCAL_CFLAGS}
+        ${WARNINGS_CFLAGS}
+    )
+else()
+    set(WIRESHARK_C_FLAGS
+        -O2
+        -g
+        -Wall
+        -W
+        -Wextra
+        -Wendif-labels
+        -Wpointer-arith
+        -Warray-bounds
+        -Wformat-security
+        -Wshorten-64-to-32
+        -Wvla
+        -Waddress
+        -Warray-bounds
+        -Wattributes
+        -Wdiv-by-zero
+        -Wignored-qualifiers
+        -Wno-overlength-strings
+        -Wwrite-strings
+        -Wno-long-long
+        -Wpragmas
+    )
+
+    set(WIRESHARK_C_ONLY_FLAGS
+        # The following are C only, not C++
+        -Wc++-compat
+        -Wdeclaration-after-statement
+        -Wshadow
+        -Wno-pointer-sign
+        -Wold-style-definition
+        -Wstrict-prototypes
+        -Wlogical-op
+        -Wjump-misses-init
+    )
+
+    set(WIRESHARK_EXTRA_C_FLAGS
+        -pedantic
+        -Woverflow
+        -fstrict-overflow -Wstrict-overflow=4
+        -Wunreachable-code
+        -Wunsafe-loop-optimizations
+        -Wcast-align
+        -Wcast-qual
+        -Wformat-security
+        -Wredundant-decls
+        # All the registration functions block these for now.
+        -Wmissing-declarations
+    )
+
+    set(WIRESHARK_EXTRA_C_ONLY_FLAGS
+        # The following are C only, not C++
+        -Wbad-function-cast
+        # All the registration functions block these for now.
+        -Wmissing-prototypes
+    )
+
+    # With clang some tests don't fail properly during testing but only
+    # during real compiles
+
+    if(NOT CMAKE_C_COMPILER_ID MATCHES "Clang")
+
+        set(WIRESHARK_C_FLAGS ${WIRESHARK_C_FLAGS}
+            -fexcess-precision=fast
+        )
+
+        set(WIRESHARK_C_ONLY_FLAGS ${WIRESHARK_C_ONLY_FLAGS}
+        )
+    endif()
+
+    if(ENABLE_EXTRA_GCC_CHECKS)   # This overrides -Werror
+        set(WIRESHARK_C_FLAGS ${WIRESHARK_C_FLAGS} ${WIRESHARK_EXTRA_C_FLAGS})
+        set(WIRESHARK_C_ONLY_FLAGS ${WIRESHARK_C_ONLY_FLAGS} ${WIRESHARK_EXTRA_C_ONLY_FLAGS})
+    endif()
+
+    add_definitions(
+        -DG_DISABLE_DEPRECATED
+        -DG_DISABLE_SINGLE_INCLUDES
+    )
 endif()
 
-add_definitions(
-       -DG_DISABLE_DEPRECATED
-       -DG_DISABLE_SINGLE_INCLUDES
-)
-
 # Counterhack to work around some cache magic in CHECK_C_SOURCE_COMPILES
 include(CheckCCompilerFlag)
 
index df45e6a074af737d1079e6040407d49445d06b07..541dccf106484debc3307348a89b899fa7e26139 100644 (file)
@@ -33,8 +33,8 @@ How to do out of tree build (Unix/Linux):
 3) mkdir build
 4) cd build
 5) cmake ../<Name_of_WS_source_dir>
-6) make
-6) (as root) umask 0022 && make install
+6) make (or cmake --build .)
+7) (as root) umask 0022 && make install
 
 Note 1:
 in step 5), you may override the defaults for features:
@@ -54,6 +54,21 @@ Note 4:
   http://public.kitware.com/Bug/view.php?id=9620
   To get predictable results please set umask explicitly.
 
+How to do out of tree build (Win32/64):
+[This is early alpha and the build will most likely die during the cmake
+ stage - don't waste your time testing unless you are willing to fix things
+ yourself]
+1) Follow http://www.wireshark.org/docs/wsdg_html_chunked/ChSetupWin32.html
+   Steps 1-9
+1a) Set WIRESHARK_BASE_DIR=c:\wireshark (the parent directory of the
+   library directory).
+2) Install cmake
+3) mkdir c:\wireshark\build
+4) cd c:\wireshark\build
+5) cmake -G "NMake Makefiles" .. (if the sources are in c:\wireshark)
+6) make (or cmake --build .)
+7) (as root) umask 0022 && make install
+
 Why cmake?
 ==========
 - Can create project files for some MS and Apple IDEs.
index e4552d7bd04f90447c0f411cc8477a9f5cbc47a1..ae552517fb6674fbe9fbef856b365d11ed1c4bf2 100644 (file)
@@ -14,10 +14,13 @@ IF (CARES_INCLUDE_DIRS)
   SET(CARES_FIND_QUIETLY TRUE)
 ENDIF (CARES_INCLUDE_DIRS)
 
-FIND_PATH(CARES_INCLUDE_DIR ares.h)
+INCLUDE(FindWSWinLibs)
+FindWSWinLibs("c-ares-.*" "CARES_HINTS")
 
-SET(CARES_NAMES cares)
-FIND_LIBRARY(CARES_LIBRARY NAMES ${CARES_NAMES} )
+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 
 # all listed variables are TRUE
index 2a01cad8cf5e4e06216a1df5ac8162222b96d3ea..aa48f16053d591ed4d611a1ebcdec95853e5d568 100644 (file)
@@ -14,11 +14,14 @@ IF (GCRYPT_INCLUDE_DIRS)
   SET(GCRYPT_FIND_QUIETLY TRUE)
 ENDIF (GCRYPT_INCLUDE_DIRS)
 
-FIND_PATH(GCRYPT_INCLUDE_DIR gcrypt.h)
+INCLUDE(FindWSWinLibs)
+FindWSWinLibs("gnutls-.*" "GCRYPT_HINTS")
 
-SET(GCRYPT_NAMES gcrypt)
-FIND_LIBRARY(GCRYPT_LIBRARY NAMES ${GCRYPT_NAMES} )
-FIND_LIBRARY(GCRYPT_ERROR_LIBRARY NAMES gpg-error )
+FIND_PATH(GCRYPT_INCLUDE_DIR gcrypt.h HINTS "${GCRYPT_HINTS}/include")
+
+SET(GCRYPT_NAMES gcrypt libgcrypt-11)
+FIND_LIBRARY(GCRYPT_LIBRARY NAMES ${GCRYPT_NAMES} HINTS "${GCRYPT_HINTS}/bin")
+FIND_LIBRARY(GCRYPT_ERROR_LIBRARY NAMES gpg-error libgpg-error-0 HINTS "${GCRYPT_HINTS}/bin")
 
 # handle the QUIETLY and REQUIRED arguments and set GCRYPT_FOUND to TRUE if 
 # all listed variables are TRUE
index 09a763ea230035f06b8f264e8264a16f52066f0c..bfd4c933f40c745c1cec8f2bfd8e948dcb7a8c35 100644 (file)
@@ -14,10 +14,13 @@ IF (GEOIP_INCLUDE_DIRS)
   SET(GEOIP_FIND_QUIETLY TRUE)
 ENDIF (GEOIP_INCLUDE_DIRS)
 
-FIND_PATH(GEOIP_INCLUDE_DIR GeoIP.h)
+INCLUDE(FindWSWinLibs)
+FindWSWinLibs("GeoIP-.*" "GEOIP_HINTS")
 
-SET(GEOIP_NAMES GeoIP)
-FIND_LIBRARY(GEOIP_LIBRARY NAMES ${GEOIP_NAMES} )
+FIND_PATH(GEOIP_INCLUDE_DIR GeoIP.h HINTS "${GEOIP_HINTS}/include" )
+
+SET(GEOIP_NAMES GeoIP libGeoIP-1)
+FIND_LIBRARY(GEOIP_LIBRARY NAMES ${GEOIP_NAMES} HINTS "${GEOIP_HINTS}/lib" )
 
 # handle the QUIETLY and REQUIRED arguments and set GEOIP_FOUND to TRUE if 
 # all listed variables are TRUE
index 03be273b2bbce4cf059c1feb5a4688e41fdfa23e..08bb950d42f3173d05b4d746e0415a48b67bcf8d 100644 (file)
@@ -23,6 +23,8 @@
 #  For details see the accompanying COPYING-CMAKE-SCRIPTS file.
 #
 
+INCLUDE(FindWSWinLibs)
+FindWSWinLibs("gtk2" "GLIB2_HINTS")
 
 IF (GLIB2_LIBRARIES AND GLIB2_INCLUDE_DIRS )
   # in cache already
@@ -69,6 +71,8 @@ ELSE (GLIB2_LIBRARIES AND GLIB2_INCLUDE_DIRS )
     ${CMAKE_LIBRARY_PATH}
   PATH_SUFFIXES
     glib-2.0/include
+  HINTS
+    "${GLIB2_HINTS}/lib"
   )
 
   FIND_PATH(
@@ -84,6 +88,8 @@ ELSE (GLIB2_LIBRARIES AND GLIB2_INCLUDE_DIRS )
     /usr/local/include
   PATH_SUFFIXES
     glib-2.0
+  HINTS
+    "${GLIB2_HINTS}/include"
   )
 
   #MESSAGE(STATUS "Glib headers: ${_glib2_include_DIR}")
@@ -101,6 +107,8 @@ ELSE (GLIB2_LIBRARIES AND GLIB2_INCLUDE_DIRS )
     /sw/lib
     /usr/lib
     /usr/local/lib
+  HINTS
+    "${GLIB2_HINTS}/lib"
   )
   IF ( _glib2_include_DIR AND _glib2_link_DIR )
       SET ( _glib2_FOUND TRUE )
index bb99067a02c4371f1abcc7e9d12f069838967c6f..2367bb6e26183f15e665b7f4e2f0511cb7e0a8af 100644 (file)
@@ -1,12 +1,12 @@
 #
 # $Id$
 #
-# - Try to find GModule2 
+# - Try to find GModule2
 # Find GModule headers, libraries and the answer to all questions.
 #
 #  GMODULE2_FOUND               True if GMODULE2 got found
-#  GMODULE2_INCLUDE_DIRS        Location of GMODULE2 headers 
-#  GMODULE2_LIBRARIES           List of libraries to use GMODULE2 
+#  GMODULE2_INCLUDE_DIRS        Location of GMODULE2 headers
+#  GMODULE2_LIBRARIES           List of libraries to use GMODULE2
 #
 #  Copyright (c) 2008 Bjoern Ricks <bjoern.ricks@googlemail.com>
 #
@@ -20,7 +20,7 @@ INCLUDE( FindPkgConfig )
 IF ( GMODULE2_FIND_REQUIRED )
        SET( _pkgconfig_REQUIRED "REQUIRED" )
 ELSE( GMODULE2_FIND_REQUIRED )
-       SET( _pkgconfig_REQUIRED "" )   
+       SET( _pkgconfig_REQUIRED "" )
 ENDIF ( GMODULE2_FIND_REQUIRED )
 
 IF ( GMODULE2_MIN_VERSION )
@@ -31,26 +31,30 @@ ENDIF ( GMODULE2_MIN_VERSION )
 
 
 IF( NOT GMODULE2_FOUND AND NOT PKG_CONFIG_FOUND )
-       FIND_PATH( GMODULE2_INCLUDE_DIRS gmodule.h PATH_SUFFIXES glib-2.0 )
+
+       INCLUDE(FindWSWinLibs)
+       FindWSWinLibs("gtk2" "GMODULE2_HINTS")
+
+       FIND_PATH( GMODULE2_INCLUDE_DIRS gmodule.h PATH_SUFFIXES glib-2.0 HINTS "${GMODULE2_HINTS}/include" )
 
        IF ( APPLE )
                FIND_LIBRARY( GMODULE2_LIBRARIES glib )
        ELSE ( APPLE )
-               FIND_LIBRARY( GMODULE2_LIBRARIES NAMES gmodule-2.0 gmodule )
+               FIND_LIBRARY( GMODULE2_LIBRARIES NAMES gmodule-2.0 gmodule HINTS "${GMODULE2_HINTS}/lib" )
        ENDIF (APPLE)
 
        # Report results
-       IF ( GMODULE2_LIBRARIES AND GMODULE2_INCLUDE_DIRS )     
+       IF ( GMODULE2_LIBRARIES AND GMODULE2_INCLUDE_DIRS )
                SET( GMODULE2_FOUND 1 )
                IF ( NOT GMODULE2_FIND_QUIETLY )
                        MESSAGE( STATUS "Found GMODULE2: ${GMODULE2_LIBRARIES} ${GMODULE2_INCLUDE_DIRS}" )
                ENDIF ( NOT GMODULE2_FIND_QUIETLY )
-       ELSE ( GMODULE2_LIBRARIES AND GMODULE2_INCLUDE_DIRS )   
+       ELSE ( GMODULE2_LIBRARIES AND GMODULE2_INCLUDE_DIRS )
                IF ( GMODULE2_FIND_REQUIRED )
                        MESSAGE( SEND_ERROR "Could NOT find GMODULE2" )
                ELSE ( GMODULE2_FIND_REQUIRED )
                        IF ( NOT GMODULE2_FIND_QUIETLY )
-                               MESSAGE( STATUS "Could NOT find GMODULE2" )     
+                               MESSAGE( STATUS "Could NOT find GMODULE2" )
                        ENDIF ( NOT GMODULE2_FIND_QUIETLY )
                ENDIF ( GMODULE2_FIND_REQUIRED )
        ENDIF ( GMODULE2_LIBRARIES AND GMODULE2_INCLUDE_DIRS )
index 91f105881d731ae569cf6f2c5a22293ae98c361a..fe5c521f0adf4a56d5d7abd7f442d888cb2862f8 100644 (file)
@@ -14,15 +14,19 @@ IF (GNUTLS_INCLUDE_DIRS)
   SET(GNUTLS_FIND_QUIETLY TRUE)
 ENDIF (GNUTLS_INCLUDE_DIRS)
 
+INCLUDE(FindWSWinLibs)
+FindWSWinLibs("gnutls-.*" "GNUTLS_HINTS")
+
 FIND_PATH(GNUTLS_INCLUDE_DIR
        NAMES
          gnutls.h
          gnutls/gnutls.h
 #      PATHS
+    HINTS "${GNUTLS_HINTS}/include"
 )
 
-SET(GNUTLS_NAMES gnutls)
-FIND_LIBRARY(GNUTLS_LIBRARY NAMES ${GNUTLS_NAMES} )
+SET(GNUTLS_NAMES gnutls libgnutls-26)
+FIND_LIBRARY(GNUTLS_LIBRARY NAMES ${GNUTLS_NAMES} HINTS "${GNUTLS_HINTS}/bin" )
 
 # handle the QUIETLY and REQUIRED arguments and set GNUTLS_FOUND to TRUE if 
 # all listed variables are TRUE
index 8bcbacac72eb45fabe679c79a3f243e5e4a1db92..9b89f55eb9e842fa0497adbd247c7853cbf21d53 100644 (file)
@@ -1,12 +1,12 @@
-# - Try to find GThread2 
+# - Try to find GThread2
 #
 # $Id$
 #
 # Find GThread headers, libraries and the answer to all questions.
 #
 #  GTHREAD2_FOUND               True if GTHREAD2 got found
-#  GTHREAD2_INCLUDE_DIRS        Location of GTHREAD2 headers 
-#  GTHREAD2_LIBRARIES           List of libraries to use GTHREAD2 
+#  GTHREAD2_INCLUDE_DIRS        Location of GTHREAD2 headers
+#  GTHREAD2_LIBRARIES           List of libraries to use GTHREAD2
 #
 #  Copyright (c) 2008 Bjoern Ricks <bjoern.ricks@googlemail.com>
 #
@@ -20,7 +20,7 @@ INCLUDE( FindPkgConfig )
 IF ( GTHREAD2_FIND_REQUIRED )
        SET( _pkgconfig_REQUIRED "REQUIRED" )
 ELSE( GTHREAD2_FIND_REQUIRED )
-       SET( _pkgconfig_REQUIRED "" )   
+       SET( _pkgconfig_REQUIRED "" )
 ENDIF ( GTHREAD2_FIND_REQUIRED )
 
 IF ( GTHREAD2_MIN_VERSION )
@@ -31,28 +31,32 @@ ENDIF ( GTHREAD2_MIN_VERSION )
 
 
 IF( NOT GTHREAD2_FOUND AND NOT PKG_CONFIG_FOUND )
-       FIND_PATH( GTHREAD2_INCLUDE_DIRS gthread.h PATH_SUFFIXES glib-2.0 glib GLib.framework/Headers/glib )
-       IF ( APPLE ) 
+
+       INCLUDE(FindWSWinLibs)
+       FindWSWinLibs("gtk2" "GTHREAD2_HINTS")
+
+       FIND_PATH( GTHREAD2_INCLUDE_DIRS gthread.h PATH_SUFFIXES glib-2.0 glib GLib.framework/Headers/glib glib-2.0/glib HINTS "${GTHREAD2_HINTS}/include" )
+       IF ( APPLE )
                FIND_LIBRARY( GTHREAD2_LIBRARIES glib )
        ELSE ( APPLE )
-               FIND_LIBRARY( GTHREAD2_LIBRARIES gthread-2.0 )
+               FIND_LIBRARY( GTHREAD2_LIBRARIES gthread-2.0 HINTS "${GTHREAD2_HINTS}/lib" )
        ENDIF ( APPLE )
-       
+
        #MESSAGE( STATUS "Gthread headers: ${GTHREAD2_INCLUDE_DIRS}" )
        #MESSAGE( STATUS "Gthread libs: ${GTHREAD2_LIBRARIES}" )
-       
+
        # Report results
-       IF ( GTHREAD2_LIBRARIES AND GTHREAD2_INCLUDE_DIRS )     
+       IF ( GTHREAD2_LIBRARIES AND GTHREAD2_INCLUDE_DIRS )
                SET( GTHREAD2_FOUND 1 )
                IF ( NOT GTHREAD2_FIND_QUIETLY )
                        MESSAGE( STATUS "Found GTHREAD2: ${GTHREAD2_LIBRARIES} ${GTHREAD2_INCLUDE_DIRS}" )
                ENDIF ( NOT GTHREAD2_FIND_QUIETLY )
-       ELSE ( GTHREAD2_LIBRARIES AND GTHREAD2_INCLUDE_DIRS )   
+       ELSE ( GTHREAD2_LIBRARIES AND GTHREAD2_INCLUDE_DIRS )
                IF ( GTHREAD2_FIND_REQUIRED )
                        MESSAGE( SEND_ERROR "Could NOT find GTHREAD2" )
                ELSE ( GTHREAD2_FIND_REQUIRED )
                        IF ( NOT GTHREAD2_FIND_QUIETLY )
-                               MESSAGE( STATUS "Could NOT find GTHREAD2" )     
+                               MESSAGE( STATUS "Could NOT find GTHREAD2" )
                        ENDIF ( NOT GTHREAD2_FIND_QUIETLY )
                ENDIF ( GTHREAD2_FIND_REQUIRED )
        ENDIF ( GTHREAD2_LIBRARIES AND GTHREAD2_INCLUDE_DIRS )
index 1569f53dfbb552ba7349508018de6144e66ec5de..9e02412dbde1f97f543277c87a5667a50ab492a2 100644 (file)
 # Version 0.5 (12/19/08)
 #   Second release to cmake mailing list
 
+INCLUDE(FindWSWinLibs)
+FindWSWinLibs("gtk2" "GTK2_HINTS")
+
 #=============================================================
 # _GTK2_GET_VERSION
 # Internal function to parse the version number in gtkversion.h
@@ -206,6 +209,9 @@ function(_GTK2_FIND_INCLUDE_DIR _var _hdr)
             [HKEY_LOCAL_MACHINE\\SOFTWARE\\gtkmm\\2.4;Path]/lib
         PATH_SUFFIXES
             ${_suffixes}
+        HINTS
+            "${GTK2_HINTS}/include"
+            "${GTK2_HINTS}/lib"
     )
 
     if(${_var})
@@ -313,6 +319,8 @@ function(_GTK2_FIND_LIBRARY _var _lib _expand_vc _append_version)
             $ENV{GTKMM_BASEPATH}/lib
             [HKEY_CURRENT_USER\\SOFTWARE\\gtkmm\\2.4;Path]/lib
             [HKEY_LOCAL_MACHINE\\SOFTWARE\\gtkmm\\2.4;Path]/lib
+        HINTS
+            "${GTK2_HINTS}/lib"
         )
 
     if(_expand_vc AND MSVC)
@@ -419,7 +427,9 @@ endif()
 
 find_package(Freetype)
 list(APPEND GTK2_INCLUDE_DIRS ${FREETYPE_INCLUDE_DIRS})
-list(APPEND GTK2_LIBRARIES ${FREETYPE_LIBRARIES})
+if(NOT WIN32)
+    list(APPEND GTK2_LIBRARIES ${FREETYPE_LIBRARIES})
+endif(NOT WIN32)
 
 foreach(_GTK2_component ${GTK2_FIND_COMPONENTS})
     if(_GTK2_component STREQUAL "gtk")
index 1c255350ff6d5080d5ac169d8306cb684c08a0ba..4cd312c7f46edc6261cb3102167443cc1c7a5bdd 100644 (file)
@@ -14,10 +14,13 @@ IF (KERBEROS_INCLUDE_DIRS)
   SET(KERBEROS_FIND_QUIETLY TRUE)
 ENDIF (KERBEROS_INCLUDE_DIRS)
 
-FIND_PATH(KERBEROS_INCLUDE_DIR krb5.h)
+INCLUDE(FindWSWinLibs)
+FindWSWinLibs("kfw-.*" "KERBOROS_HINTS")
 
-SET(KERBEROS_NAMES krb5)
-FIND_LIBRARY(KERBEROS_LIBRARY NAMES ${KERBEROS_NAMES} )
+FIND_PATH(KERBEROS_INCLUDE_DIR krb5.h HINTS "${KERBOROS_HINTS}/include" )
+
+SET(KERBEROS_NAMES krb5 krb5_32)
+FIND_LIBRARY(KERBEROS_LIBRARY NAMES ${KERBEROS_NAMES} HINTS "${KERBOROS_HINTS}/lib" )
 
 # handle the QUIETLY and REQUIRED arguments and set KERBEROS_FOUND to TRUE if 
 # all listed variables are TRUE
index 4c5577e9ea8f5f0dfbdc4f5b0b4602a895d64994..d0a46a973f8ee05353e415c0b7d9bdda53082697 100644 (file)
 # This is because, the lua location is not standardized and may exist
 # in locations other than lua/
 
+INCLUDE(FindWSWinLibs)
+FindWSWinLibs("lua5*" "LUA_HINTS")
 
 FIND_PATH(LUA_INCLUDE_DIR lua.h
   HINTS
   $ENV{LUA_DIR}
+  ${LUA_HINTS}
   PATH_SUFFIXES include/lua52 include/lua5.2 include/lua51 include/lua5.1 include/lua include
   PATHS
   ~/Library/Frameworks
@@ -49,6 +52,7 @@ FIND_LIBRARY(LUA_LIBRARY
   NAMES lua${LUA_INC_SUFFIX} lua52 lua5.2 lua51 lua5.1 lua
   HINTS
   $ENV{LUA_DIR}
+  ${LUA_HINTS}
   PATH_SUFFIXES lib64 lib
   PATHS
   ~/Library/Frameworks
index 1d3c1b6c0da727f54d29488ecc002963a539c2b8..bd7fafaca1e8e1228a634731cd092390cb4b6846 100644 (file)
@@ -68,15 +68,24 @@ IF(EXISTS $ENV{PCAPDIR})
 
 
 ELSE(EXISTS $ENV{PCAPDIR})
+
+  INCLUDE(FindWSWinLibs)
+  FindWSWinLibs("WpdPack" "PCAP_HINTS")
+
   FIND_PATH(PCAP_INCLUDE_DIR
     NAMES
     pcap/pcap.h
     pcap.h
+    HINTS
+      "${PCAP_HINTS}/include"
   )
 
   FIND_LIBRARY(PCAP_LIBRARY
     NAMES
       pcap
+      wpcap
+    HINTS
+      "${PCAP_HINTS}/lib"
   )
 
 ENDIF(EXISTS $ENV{PCAPDIR})
index 29f831185c93c1817e4f1956509c615b55000e8a..3735ddb7f78dd3d99329341e0eb06894c9a27cd9 100644 (file)
@@ -14,7 +14,10 @@ IF (PORTAUDIO_INCLUDE_DIRS)
   SET(PORTAUDIO_FIND_QUIETLY TRUE)
 ENDIF (PORTAUDIO_INCLUDE_DIRS)
 
-FIND_PATH(PORTAUDIO_INCLUDE_DIR portaudio.h)
+INCLUDE(FindWSWinLibs)
+FindWSWinLibs("portaudio_.*" "PORTAUDIO_HINTS")
+
+FIND_PATH(PORTAUDIO_INCLUDE_DIR portaudio.h HINTS "${PORTAUDIO_HINTS}/include" )
 
 SET(PORTAUDIO_NAMES portaudio)
 FIND_LIBRARY(PORTAUDIO_LIBRARY NAMES ${PORTAUDIO_NAMES} )
index 8850cb65d951235284a2c04db75c9c7a61defbdb..a483ebf0516afbcd148d66b5f8db2f96f98e47a3 100644 (file)
@@ -14,10 +14,13 @@ IF (SMI_INCLUDE_DIR)
   SET(SMI_FIND_QUIETLY TRUE)
 ENDIF (SMI_INCLUDE_DIR)
 
-FIND_PATH(SMI_INCLUDE_DIR smi.h)
+INCLUDE(FindWSWinLibs)
+FindWSWinLibs("libsmi-.*" "SMI_HINTS")
 
-SET(SMI_NAMES smi)
-FIND_LIBRARY(SMI_LIBRARY NAMES ${SMI_NAMES} )
+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 
 # all listed variables are TRUE
diff --git a/cmake/modules/FindWSWinLibs.cmake b/cmake/modules/FindWSWinLibs.cmake
new file mode 100644 (file)
index 0000000..3442e84
--- /dev/null
@@ -0,0 +1,26 @@
+#
+# $Id$
+#
+# - Find WSWin Libs
+#  Due to the layout of the Wireshark Win support libs,
+#  CMake needs some support to find them
+#
+#  The function is passed the directory name to search for and the variable
+#  to set in the callers scope.
+
+function(FindWSWinLibs _WS_LIB_SEARCH_PATH _LIB_HINT_VAR)
+  if (WIN32)
+    set( _WS_BASE_DIR $ENV{WIRESHARK_BASE_DIR} )
+    set( _WS_TARGET_PLATFORM $ENV{WIRESHARK_TARGET_PLATFORM} )
+    set( _PROJECT_LIB_DIR "${_WS_BASE_DIR}/wireshark-${_WS_TARGET_PLATFORM}-libs" )
+    file( GLOB _SUBDIR "${_PROJECT_LIB_DIR}/*" )
+    foreach( _DIR ${_SUBDIR} )
+      if( IS_DIRECTORY ${dir} )
+        if( "${_DIR}" matches ".*/${_WS_LIB_SEARCH_PATH}" )
+          set( ${_LIB_HINT_VAR} ${_DIR} PARENT_SCOPE )
+        endif()
+      endif()
+    endforeach()
+  endif()
+endfunction(FindWSWinLibs)
+