diff options
author | Gerald Combs <gerald@wireshark.org> | 2015-10-06 13:29:14 -0700 |
---|---|---|
committer | Gerald Combs <gerald@wireshark.org> | 2015-10-06 21:41:25 +0000 |
commit | 81d8b7dcdcf67ef530deea0002a638aa57724c51 (patch) | |
tree | 4cf57b987c8fe9cd0910fab99d9275fb955c9e4a /cmake/modules | |
parent | a37ac98c5eb5c44794ca36418f93e7ed1c3e0af5 (diff) |
CMake: Don't clobber ZLIB_*.
On Windows we set a few (but not all) ZLIB_* variables, then depend on
FindZLIB to fill in the rest. Make sure FindZLIB doesn't unset everything
the first time we run CMake.
Bug: 11569
Change-Id: I199c83570c29343466b9ff63080b6a964dfd8d73
Reviewed-on: https://code.wireshark.org/review/10843
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Gerald Combs <gerald@wireshark.org>
Diffstat (limited to 'cmake/modules')
-rw-r--r-- | cmake/modules/FindZLIB.cmake | 79 |
1 files changed, 41 insertions, 38 deletions
diff --git a/cmake/modules/FindZLIB.cmake b/cmake/modules/FindZLIB.cmake index 9fcbb39032..212867e769 100644 --- a/cmake/modules/FindZLIB.cmake +++ b/cmake/modules/FindZLIB.cmake @@ -34,34 +34,37 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) -INCLUDE(FindWSWinLibs) -FindWSWinLibs("zlib" "ZLIB_HINTS") +# We set these manually on Windows. +#INCLUDE(FindWSWinLibs) +#FindWSWinLibs("zlib" "ZLIB_HINTS") -find_package(PkgConfig) -pkg_search_module(ZLIB zlib) +if (NOT ZLIB_INCLUDE_DIR OR NOT ZLIB_LIBRARY) + find_package(PkgConfig) + pkg_search_module(ZLIB zlib) -FIND_PATH(ZLIB_INCLUDE_DIR - NAMES - zlib.h - HINTS - "${ZLIB_INCLUDEDIR}" - ${ZLIB_HINTS}/include - ${ZLIB_HINTS} - PATHS - "[HKEY_LOCAL_MACHINE\\SOFTWARE\\GnuWin32\\Zlib;InstallPath]/include" -) + FIND_PATH(ZLIB_INCLUDE_DIR + NAMES + zlib.h + HINTS + "${ZLIB_INCLUDEDIR}" + ${ZLIB_HINTS}/include + ${ZLIB_HINTS} + PATHS + "[HKEY_LOCAL_MACHINE\\SOFTWARE\\GnuWin32\\Zlib;InstallPath]/include" + ) -SET(ZLIB_NAMES z zlib zdll zlib1 zlibd zlibd1) -FIND_LIBRARY(ZLIB_LIBRARY - NAMES - ${ZLIB_NAMES} - HINTS - "${ZLIB_LIBDIR}" - ${ZLIB_HINTS}/lib - ${ZLIB_HINTS} - PATHS - "[HKEY_LOCAL_MACHINE\\SOFTWARE\\GnuWin32\\Zlib;InstallPath]/lib" -) + SET(ZLIB_NAMES z zlib zdll zlib1 zlibd zlibd1) + FIND_LIBRARY(ZLIB_LIBRARY + NAMES + ${ZLIB_NAMES} + HINTS + "${ZLIB_LIBDIR}" + ${ZLIB_HINTS}/lib + ${ZLIB_HINTS} + PATHS + "[HKEY_LOCAL_MACHINE\\SOFTWARE\\GnuWin32\\Zlib;InstallPath]/lib" + ) +endif() MARK_AS_ADVANCED(ZLIB_LIBRARY ZLIB_INCLUDE_DIR) IF(ZLIB_INCLUDE_DIR AND EXISTS "${ZLIB_INCLUDE_DIR}/zlib.h") @@ -99,19 +102,19 @@ 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() + #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 ) |