diff --git a/CMakeLists.txt b/CMakeLists.txt index 6596f0107..096e14d59 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -681,9 +681,14 @@ if(ENABLE_STATIC) endif() if(PNG_SUPPORTED) + if (APPLE) + find_package(ZLIB REQUIRED) # macos doesn't have static zlib + endif() set(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_STATIC_LIBRARY_SUFFIX}) find_package(PNG 1.6 REQUIRED) - find_package(ZLIB REQUIRED) + if (NOT APPLE) + find_package(ZLIB REQUIRED) + endif() target_include_directories(cjpeg-static PUBLIC ${PNG_INCLUDE_DIR} ${ZLIB_INCLUDE_DIR}) target_link_libraries(cjpeg-static ${PNG_LIBRARY} ${ZLIB_LIBRARY}) endif()