tools/cmake: Build without some included libs
[openwrt/staging/ansuel.git] / tools / cmake / patches / 140-zlib.patch
1 --- a/Modules/FindZLIB.cmake
2 +++ b/Modules/FindZLIB.cmake
3 @@ -85,10 +85,13 @@ else()
4 set(ZLIB_NAMES_DEBUG zd zlibd zdlld zlibd1 zlib1d zlibstaticd zlibwapid zlibvcd zlibstatd)
5 endif()
6
7 -# Try each search configuration.
8 -foreach(search ${_ZLIB_SEARCHES})
9 - find_path(ZLIB_INCLUDE_DIR NAMES zlib.h ${${search}} PATH_SUFFIXES include)
10 -endforeach()
11 +if(UNIX)
12 + find_package(PkgConfig QUIET)
13 + pkg_search_module(PC_zlib zlib)
14 +endif()
15 +
16 +find_path(ZLIB_INCLUDE_DIR zlib.h HINTS ${PC_zlib_INCLUDEDIR} ${PC_zlib_INCLUDE_DIRS})
17 +find_library(ZLIB_LIBRARY NAMES z HINTS ${PC_zlib_LIBDIR} ${PC_zlib_LIBRARY_DIRS})
18
19 # Allow ZLIB_LIBRARY to be set manually, as the location of the zlib library
20 if(NOT ZLIB_LIBRARY)