diff --git a/cmake/modules/zlib.cmake b/cmake/modules/zlib.cmake index c947f897bb..872e4455d8 100644 --- a/cmake/modules/zlib.cmake +++ b/cmake/modules/zlib.cmake @@ -73,19 +73,21 @@ else() else() if(BUILD_SHARED_LIBS) set(ZLIB_LIB_SUFFIX "${CMAKE_SHARED_LIBRARY_SUFFIX}") + set(ZLIB_LIB "${ZLIB_SRC}/lib/zlib${ZLIB_LIB_SUFFIX}") else() set(ZLIB_LIB_SUFFIX "${CMAKE_STATIC_LIBRARY_SUFFIX}") + set(ZLIB_LIB "${ZLIB_SRC}/lib/zlibstatic${ZLIB_LIB_SUFFIX}") endif() - set(ZLIB_LIB "${ZLIB_SRC}/zlib${ZLIB_LIB_SUFFIX}") ExternalProject_Add(zlib PREFIX "${PROJECT_BINARY_DIR}/zlib-prefix" URL "https://github.com/madler/zlib/archive/v1.2.13.tar.gz" URL_HASH "SHA256=1525952a0a567581792613a9723333d7f8cc20b87a81f920fb8bc7e3f2251428" - CONFIGURE_COMMAND "" - BUILD_COMMAND nmake -f win32/Makefile.msc LOC="\"${ZLIB_CFLAGS} -DZLIB_WINAPI\"" BUILD_IN_SOURCE 1 BUILD_BYPRODUCTS ${ZLIB_LIB} - INSTALL_COMMAND "") + CMAKE_ARGS + -DCMAKE_POSITION_INDEPENDENT_CODE=${ENABLE_PIC} + -DBUILD_SHARED_LIBS=${BUILD_SHARED_LIBS} + -DCMAKE_INSTALL_PREFIX=${ZLIB_SRC}) install(FILES "${ZLIB_LIB}" DESTINATION "${CMAKE_INSTALL_LIBDIR}/${LIBS_PACKAGE_NAME}" COMPONENT "libs-deps") install(FILES ${ZLIB_HEADERS} DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/${LIBS_PACKAGE_NAME}/zlib"