diff options
author | jmayer <jmayer@f5534014-38df-0310-8fa8-9805f1628bb7> | 2011-06-08 16:24:36 +0000 |
---|---|---|
committer | jmayer <jmayer@f5534014-38df-0310-8fa8-9805f1628bb7> | 2011-06-08 16:24:36 +0000 |
commit | eb089ed889499a0f7648a9beda62e53185952856 (patch) | |
tree | b9aa14acdd5e45d8f19bdb1aa43acb035cde1a2d /cmake | |
parent | 438175b11eb33670cb6d277e5aa88449d513dfca (diff) |
Copy over changes from cmake git HEAD.
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@37619 f5534014-38df-0310-8fa8-9805f1628bb7
Diffstat (limited to 'cmake')
-rw-r--r-- | cmake/modules/FindGTK2.cmake | 13 | ||||
-rw-r--r-- | cmake/modules/FindZLIB.cmake | 77 |
2 files changed, 62 insertions, 28 deletions
diff --git a/cmake/modules/FindGTK2.cmake b/cmake/modules/FindGTK2.cmake index 51034d9089..fc810ba6c4 100644 --- a/cmake/modules/FindGTK2.cmake +++ b/cmake/modules/FindGTK2.cmake @@ -66,6 +66,10 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) +# Version 1.3 (11/9/2010) (CMake 2.8.4) +# * 11429: Add support for detecting GTK2 built with Visual Studio 10. +# Thanks to Vincent Levesque for the patch. + # Version 1.2 (8/30/2010) (CMake 2.8.3) # * Merge patch for detecting gdk-pixbuf library (split off # from core GTK in 2.21). Thanks to Vincent Untz for the patch @@ -238,15 +242,16 @@ function(_GTK2_FIND_LIBRARY _var _lib _expand_vc _append_version) set(_library ${_lib}) - if(_expand_vc) - # Add vc80/vc90 midfixes + if(_expand_vc AND MSVC) + # Add vc80/vc90/vc100 midfixes if(MSVC80) set(_library ${_library}-vc80) - set(_library_d ${_library}-d) elseif(MSVC90) set(_library ${_library}-vc90) - set(_library_d ${_library}-d) + elseif(MSVC10) + set(_library ${_library}-vc100) endif() + set(_library_d ${_library}-d) endif() if(GTK2_DEBUG) diff --git a/cmake/modules/FindZLIB.cmake b/cmake/modules/FindZLIB.cmake index 3111573c67..9b01679f96 100644 --- a/cmake/modules/FindZLIB.cmake +++ b/cmake/modules/FindZLIB.cmake @@ -1,11 +1,22 @@ # - Find zlib -# Find the native ZLIB includes and library +# Find the native ZLIB includes and library. +# Once done this will define # -# $Id$ +# ZLIB_INCLUDE_DIRS - where to find zlib.h, etc. +# ZLIB_LIBRARIES - List of libraries when using zlib. +# ZLIB_FOUND - True if zlib found. # -# ZLIB_INCLUDE_DIRS - where to find zlib.h, etc. -# ZLIB_LIBRARIES - List of libraries when using zlib. -# ZLIB_FOUND - True if zlib found. +# ZLIB_VERSION_STRING - The version of zlib found (x.y.z) +# ZLIB_VERSION_MAJOR - The major version of zlib +# ZLIB_VERSION_MINOR - The minor version of zlib +# ZLIB_VERSION_PATCH - The patch version of zlib +# ZLIB_VERSION_TWEAK - The tweak version of zlib +# +# The following variable are provided for backward compatibility +# +# ZLIB_MAJOR_VERSION - The major version of zlib +# ZLIB_MINOR_VERSION - The minor version of zlib +# ZLIB_PATCH_VERSION - The patch version of zlib #============================================================================= # Copyright 2001-2009 Kitware, Inc. @@ -17,32 +28,50 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) -IF (ZLIB_INCLUDE_DIR) - # Already in cache, be silent - SET(ZLIB_FIND_QUIETLY TRUE) -ENDIF (ZLIB_INCLUDE_DIR) +FIND_PATH(ZLIB_INCLUDE_DIR zlib.h + "[HKEY_LOCAL_MACHINE\\SOFTWARE\\GnuWin32\\Zlib;InstallPath]/include" +) -FIND_PATH(ZLIB_INCLUDE_DIR zlib.h) +SET(ZLIB_NAMES z zlib zdll zlib1 zlibd zlibd1) +FIND_LIBRARY(ZLIB_LIBRARY + NAMES + ${ZLIB_NAMES} + PATHS + "[HKEY_LOCAL_MACHINE\\SOFTWARE\\GnuWin32\\Zlib;InstallPath]/lib" +) +MARK_AS_ADVANCED(ZLIB_LIBRARY ZLIB_INCLUDE_DIR) -SET(ZLIB_NAMES z zlib zdll) -FIND_LIBRARY(ZLIB_LIBRARY NAMES ${ZLIB_NAMES} ) -MARK_AS_ADVANCED( ZLIB_LIBRARY ZLIB_INCLUDE_DIR ) +IF(ZLIB_INCLUDE_DIR AND EXISTS "${ZLIB_INCLUDE_DIR}/zlib.h") + FILE(STRINGS "${ZLIB_INCLUDE_DIR}/zlib.h" ZLIB_H REGEX "^#define ZLIB_VERSION \"[^\"]*\"$") -# Per-recommendation -SET(ZLIB_INCLUDE_DIRS "${ZLIB_INCLUDE_DIR}") -SET(ZLIB_LIBRARIES "${ZLIB_LIBRARY}") + STRING(REGEX REPLACE "^.*ZLIB_VERSION \"([0-9]+).*$" "\\1" ZLIB_VERSION_MAJOR "${ZLIB_H}") + STRING(REGEX REPLACE "^.*ZLIB_VERSION \"[0-9]+\\.([0-9]+).*$" "\\1" ZLIB_VERSION_MINOR "${ZLIB_H}") + STRING(REGEX REPLACE "^.*ZLIB_VERSION \"[0-9]+\\.[0-9]+\\.([0-9]+).*$" "\\1" ZLIB_VERSION_PATCH "${ZLIB_H}") + SET(ZLIB_VERSION_STRING "${ZLIB_VERSION_MAJOR}.${ZLIB_VERSION_MINOR}.${ZLIB_VERSION_PATCH}") -INCLUDE(CheckFunctionExists) -SET(CMAKE_REQUIRED_LIBRARIES ${ZLIB_LIBRARIES}) -CHECK_FUNCTION_EXISTS("inflatePrime" HAVE_INFLATEPRIME) -# reset -SET(CMAKE_REQUIRED_LIBRARIES "") + # only append a TWEAK version if it exists: + SET(ZLIB_VERSION_TWEAK "") + IF( "${ZLIB_H}" MATCHES "^.*ZLIB_VERSION \"[0-9]+\\.[0-9]+\\.[0-9]+\\.([0-9]+).*$") + SET(ZLIB_VERSION_TWEAK "${CMAKE_MATCH_1}") + SET(ZLIB_VERSION_STRING "${ZLIB_VERSION_STRING}.${ZLIB_VERSION_TWEAK}") + ENDIF( "${ZLIB_H}" MATCHES "^.*ZLIB_VERSION \"[0-9]+\\.[0-9]+\\.[0-9]+\\.([0-9]+).*$") -# handle the QUIETLY and REQUIRED arguments and set ZLIB_FOUND to TRUE if + SET(ZLIB_MAJOR_VERSION "${ZLIB_VERSION_MAJOR}") + SET(ZLIB_MINOR_VERSION "${ZLIB_VERSION_MINOR}") + SET(ZLIB_PATCH_VERSION "${ZLIB_VERSION_PATCH}") +ENDIF() + +# 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 DEFAULT_MSG ZLIB_LIBRARIES ZLIB_INCLUDE_DIRS) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(ZLIB REQUIRED_VARS ZLIB_LIBRARY ZLIB_INCLUDE_DIR + VERSION_VAR ZLIB_VERSION_STRING) + +IF(ZLIB_FOUND) + SET(ZLIB_INCLUDE_DIRS ${ZLIB_INCLUDE_DIR}) + SET(ZLIB_LIBRARIES ${ZLIB_LIBRARY}) +ENDIF() |