diff options
Diffstat (limited to 'cmake')
-rw-r--r-- | cmake/modules/FindZLIB.cmake | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/cmake/modules/FindZLIB.cmake b/cmake/modules/FindZLIB.cmake index ac4259b984..34fb1bb608 100644 --- a/cmake/modules/FindZLIB.cmake +++ b/cmake/modules/FindZLIB.cmake @@ -102,6 +102,22 @@ IF(WIN32) ELSE() INCLUDE(CheckFunctionExists) SET(CMAKE_REQUIRED_LIBRARIES ${ZLIB_LIBRARY}) + # + # Check for inflate() in zlib, to make sure the zlib library is + # usable. + # + # For example, on at least some versions of Fedora, if you have a + # 64-bit machine, have both the 32-bit and 64-bit versions of the + # run-time zlib package installed, and have only the *32-bit* + # version of the zlib development package installed, it'll find the + # header, and think it can use zlib, and will use it in subsequent + # tests, but it'll try and link 64-bit test programs with the 32-bit + # library, causing those tests to falsely fail. Hilarity ensues. + # + CHECK_FUNCTION_EXISTS("inflate" HAVE_INFLATE) + IF(NOT HAVE_INFLATE) + MESSAGE(FATAL_ERROR "zlib.h found but linking with -lz failed to find inflate(); do you have the right developer package installed (32-bit vs. 64-bit)?") + ENDIF() CHECK_FUNCTION_EXISTS("inflatePrime" HAVE_INFLATEPRIME) # reset SET(CMAKE_REQUIRED_LIBRARIES "") |